Example #1
0
 /**
  * Set an option for a cURL transfer.
  *
  * @link http://www.php.net/manual/en/function.curl-setopt.php
  * @param resource $curlHandle A cURL handle returned by curl_init().
  * @param integer  $option     The CURLOPT_XXX option to set.
  * @param mixed    $value      The value to be set on option.
  *
  * @return boolean  Returns TRUE on success or FALSE on failure.
  */
 public static function curlSetopt($curlHandle, $option, $value)
 {
     CurlHelper::setCurlOptionOnRequest(self::$requests[(int) $curlHandle], $option, $value, $curlHandle);
     static::$curlOptions[(int) $curlHandle][$option] = $value;
     return \curl_setopt($curlHandle, $option, $value);
 }
Example #2
0
 public function testHandleResponseWritesFile()
 {
     vfsStream::setup('test');
     $expectedBody = 'example response';
     $testFile = vfsStream::url('test/write_file');
     $curlOptions = array(CURLOPT_FILE => fopen($testFile, 'w+'));
     $response = new Response(200, null, $expectedBody);
     CurlHelper::handleOutput($response, $curlOptions, curl_init());
     $this->assertEquals($expectedBody, file_get_contents($testFile));
 }