示例#1
0
 /**
  * Update the associated request with the values of this container.
  * @return void
  */
 protected function updateRequest()
 {
     $headers = array();
     foreach ($this->all() as $key => $values) {
         foreach ($values as $value) {
             $headers[] = $key . ': ' . $value;
         }
     }
     $this->request->setOption(CURLOPT_HTTPHEADER, $headers);
 }
示例#2
0
文件: Curl.php 项目: evlsqd/curl
 /**
  * Sets a request's HTTP verb to PUT.
  *
  * @param RequestInterface $request
  */
 protected function preparePutRequest(RequestInterface $request, $data)
 {
     $request->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
     if ($data !== null) {
         $request->setOption(CURLOPT_POSTFIELDS, $data);
     }
 }
示例#3
0
文件: Curl.php 项目: hardwork2015/cdp
 protected function preparePutRequest(RequestInterface $request, $data)
 {
     if ($data !== null) {
         // Write the PUT data to memory.
         $file = fopen('php://temp', 'rw+');
         fwrite($file, $data);
         rewind($file);
         // Add the PUT data to the request.
         $request->setOption(CURLOPT_INFILE, $file);
         $request->setOption(CURLOPT_INFILESIZE, strlen($data));
         $request->setOption(CURLOPT_PUT, true);
     } else {
         $request->setOption(CURLOPT_CUSTOMREQUEST, 'PUT');
     }
 }