Executes a PUT request.

@param string $url The URL to make the request to
@param array|string $data The full data to post in the operation
@param array $headers Optional extra headers
@return object Returns an object containing the response information.
168857
public function put($url, $data, array $headers = array())
    {
        curl_setopt($this->handle, CURLOPT_CUSTOMREQUEST, 'PUT');

        $fields = is_array($data) ? http_build_query($data) : $data;
        curl_setopt($this->handle, CURLOPT_POSTFIELDS, $fields);

        $headers = array_replace($headers, ['Content-Length' => strlen($fields)]);
        return $this->execute($url, $headers);
    }
1006409
protected function request($url, $data, $headers=array())
    {
        try{
            $result = $this->validate($url, $data);
            if($result !== true) {
                return $result;
            }

            $params = array();
            // 特殊处理
            $this->proccessRequest($url, $params, $data, $headers);
            if($this->methods == 'get') {
                $response = $this->client->get($url, $data);
            } else {
                $response = $this->client->post($url, $data, $params);
            }
            $obj = $this->proccessResult($response['content']);
        }catch(Exception $e){
            return array(
                'error_code' => 'SDK108',
                'error_msg' => 'connection or read data timeout',
            );
        }
        return $obj;
    }
481919
public function putReq(string $url, $data = [], $dataQuery = [])
    {
        $query = http_build_query($dataQuery);
        $ch    = curl_init($url . '?' . $query);
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json']);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        if ($this->authType == self::BASIC) {
            curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
            curl_setopt($ch, CURLOPT_USERPWD, $this->authParam);
        } else {
            if ($this->authType == self::SAFE) {
                curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANYSAFE);
                curl_setopt($ch, CURLOPT_USERPWD, $this->authParam);
            }
        }
        $result = curl_exec($ch);
        curl_close($ch);

        return $result;
    }
1121597
public function post($url, $data, array $headers = array())
    {
        curl_setopt($this->handle, CURLOPT_POST, true);
        curl_setopt($this->handle, CURLOPT_POSTFIELDS, $data);

        return $this->execute($url, $headers);
    }
15446
public function put($url, $data = [], $headers = [], $curl_opts = []) {
        $curl_opts[CURLOPT_CUSTOMREQUEST] = 'PUT';
        return $this->load($url, $data, $headers, $curl_opts);
    }
279718
public function update($service, $headers = null, $data)
	{
		return $this->put($service, $headers, $data);
	}
804016
public static function postRequest(string $url, array $data = [])
    {
        $url = str_replace("&amp;", "&", urldecode(trim($url)));

        if (Validate::online($url)) {
            $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data)));
            $context = stream_context_create($options);

            return file_get_contents($url, false, $context);
        }

        return false;
    }
1175119
public function addPut($url, $data = array())
    {
        if (is_array($url)) {
            $data = $url;
            $url = $this->baseUrl;
        }
        $curl = new Curl();
        $curl->setURL($url);
        $curl->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
        $put_data = $curl->buildPostData($data);
        if (is_string($put_data)) {
            $curl->setHeader('Content-Length', strlen($put_data));
        }
        $curl->setOpt(CURLOPT_POSTFIELDS, $put_data);
        $this->addHandle($curl);
        return $curl;
    }
1113370
public function post($uri, array $data = [], array $headers = [])
    {
        $server = $this->transformHeadersToServerVars($headers);

        return $this->call('POST', $uri, $data, [], [], $server);
    }
781218
public function put($url, $data = [], array $options = [])
    {
        $options = $this->_mergeOptions($options);
        $url = $this->buildUrl($url, [], $options);

        return $this->_doRequest(Request::METHOD_PUT, $url, $data, $options);
    }
15239
public function put($url, $data = array())
    {
        if (is_array($url)) {
            $data = $url;
            $url = $this->baseUrl;
        }
        $this->setUrl($url);
        $this->setOpt(CURLOPT_CUSTOMREQUEST, 'PUT');
        $put_data = $this->buildPostData($data);
        if (empty($this->options[CURLOPT_INFILE]) && empty($this->options[CURLOPT_INFILESIZE])) {
            if (is_string($put_data)) {
                $this->setHeader('Content-Length', strlen($put_data));
            }
        }
        if (!empty($put_data)) {
            $this->setOpt(CURLOPT_POSTFIELDS, $put_data);
        }
        return $this->exec();
    }
1328070
public function post($url, $data = null, $headers = [], $options = [])
    {
        return $this->createRequestShortcut('POST', $url, $data, $headers, $options);
    }
904372
public function get($url, $data = null, $header = [])
    {
        $url = URLUtil::addParameter($url, $data);
        return $this->exec($url, $data, 'get', $header);
    }
141363
public function post($url, $body, array $headers = [])
    {
        $request = $this->getClient()->createRequest('POST', $url, ['body' => $body]);
        $request->addHeaders($headers);

        return $this->sendRequest($request);
    }
598429
public static function post($url, array $data = [], array $headers = [])
    {
        // $headers = [ 'Content-Type: application/json' ];

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // 发送数据
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        // 执行HTTP请求
        return self::execute($ch);
    }
56195
public function getJSON($url,$data,$headers)
    {

        $response = $this->get($url,$data,$headers);
        $response["response"] = json_encode($response["response"]); // Again decoding it back to JSON

        return $response;
    }
1225729
public function putJSON($url, $data)
    {
        $responseBody = $this->put($url, json_encode($data), 'application/json');

        return json_decode($responseBody);
    }