Esempio n. 1
0
 /**
  * @return Curl
  */
 public static function createCurl()
 {
     $client = new Curl();
     //reaction to the ssl3.0 shutdown from paypal
     //https://www.paypal-community.com/t5/PayPal-Forward/PayPal-Response-to-SSL-3-0-Vulnerability-aka-POODLE/ba-p/891829
     //http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
     $client->setOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
     //There is a constant for that CURL_SSLVERSION_TLSv1, but it is not present on some versions of php.
     $client->setOption(CURLOPT_SSLVERSION, $curlSslVersionTlsV1 = 1);
     return $client;
 }
 /**
  * @param  string $binaryImage
  * @param  string $filename
  * @param  int    $expire
  *
  * @return Response
  */
 public function call($binaryImage, $filename, $expire)
 {
     $response = new Response();
     $image = new FormUpload();
     $image->setFilename($filename);
     $image->setContent($binaryImage);
     $request = $this->buildRequest($image, $expire);
     $this->client->setOption(CURLOPT_TIMEOUT, 10000);
     $this->client->send($request, $response);
     return $this->processResponse($response);
 }
 /**
  * Initializes context with parameters from behat.yml.
  *
  * @param array $parameters
  */
 public function __construct(array $parameters)
 {
     $this->parameters = $parameters;
     $curlBuzzClient = new Curl();
     $curlBuzzClient->setTimeout(30);
     $curlBuzzClient->setOption(CURLOPT_SSL_VERIFYHOST, 0);
     $curlBuzzClient->setOption(CURLOPT_SSL_VERIFYPEER, 0);
     $this->browser = new Browser($curlBuzzClient);
     $this->useContext('secure', new SecureContext());
     $this->useContext('activity', new ActivityContext());
     $this->useContext('group', new GroupContext());
     $this->useContext('poll', new PollContext());
 }
Esempio n. 4
0
 /**
  * Initialise
  */
 protected function init()
 {
     $client = new Curl();
     $client->setVerifyPeer(false);
     $client->setOption(CURLOPT_SSLVERSION, 3);
     $this->browser = new Browser($client);
 }
Esempio n. 5
0
 /**
  * @return Curl
  */
 public static function createCurl()
 {
     $client = new Curl();
     // Reaction to the ssl3.0 shutdown from paypal
     // https://www.paypal-community.com/t5/PayPal-Forward/PayPal-Response-to-SSL-3-0-Vulnerability-aka-POODLE/ba-p/891829
     // http://googleonlinesecurity.blogspot.com/2014/10/this-poodle-bites-exploiting-ssl-30.html
     // Do not use the Cipher List for NSS
     // https://github.com/paypal/sdk-core-php/blob/namespace-5.3/lib/PayPal/Core/PPHttpConfig.php#L51
     $curl = curl_version();
     $sslVersion = isset($curl['ssl_version']) ? $curl['ssl_version'] : '';
     if (false === strpos($sslVersion, "NSS/")) {
         $client->setOption(CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
     }
     //There is a constant for that CURL_SSLVERSION_TLSv1, but it is not present on some versions of php.
     $client->setOption(CURLOPT_SSLVERSION, $curlSslVersionTlsV1 = 1);
     return $client;
 }
Esempio n. 6
0
 /**
  * resolve curl configuration
  * @return Curl
  */
 private function prepareCurl()
 {
     $curl = new Curl();
     $curl->setOption(CURLOPT_USERAGENT, 'HypeMailchimp');
     $curl->setVerifyPeer(false);
     $curl->setTimeout($this->config['timeout']);
     return $curl;
 }
Esempio n. 7
0
 /**
  * resolve curl configuration
  * @return Curl
  */
 private function prepareCurl()
 {
     $curl = new Curl();
     $curl->setOption(CURLOPT_USERAGENT, 'Taiga-PHP-SDK');
     $curl->setVerifyPeer(false);
     $curl->setTimeout(200);
     return $curl;
 }
Esempio n. 8
0
 protected function getCurlInstance()
 {
     $curl = new Curl();
     foreach ($this->getCurlOptions() as $option => $value) {
         $curl->setOption($option, $value);
     }
     return $curl;
 }
Esempio n. 9
0
 /**
  * Initialise
  */
 protected function init()
 {
     $client = new Curl();
     $client->setVerifyPeer(false);
     $client->setOption(CURLOPT_USERPWD, $this->options['key'] . ':');
     if (isset($this->options['timeout'])) {
         $client->setTimeout($this->options['timeout']);
     }
     $this->browser = new Browser($client);
 }
 public function initBrowser($curlOptions)
 {
     $curl = new Curl();
     foreach ($curlOptions as $key => $option) {
         $curl->setOption(constant(strtoupper($key)), $option);
     }
     //to avoid ssl certificate error
     $curl->setVerifyPeer(false);
     $this->browser = new Browser($curl);
 }
 /**
  * Send API request to mailchimp
  * 
  * @param string  $apiCall mailchimp method
  * @param string  $payload Request information
  * @param boolean $export  mailchimp export api
  * 
  * @return json
  */
 protected function makeRequest($apiCall, $payload, $export = false)
 {
     $payload['apikey'] = $this->apiKey;
     $payload['id'] = $this->listId;
     if ($export) {
         $url = $this->dataCenter . $apiCall;
     } else {
         $url = $this->dataCenter . '1.3/?method=' . $apiCall;
     }
     $curl = new Curl();
     $curl->setOption(CURLOPT_USERAGENT, 'MZMailChimpBundle');
     // Set long timeout for Export API to allow for larger responses
     if ($export) {
         $curl->setOption(CURLOPT_TIMEOUT, 600);
     } else {
         $curl->setOption(CURLOPT_TIMEOUT, 30);
     }
     $browser = new Browser($curl);
     $response = $browser->post($url, array(), http_build_query($payload));
     return $response->getContent();
 }
Esempio n. 12
0
 /**
  * Resolve curl configuration.
  *
  * @return Curl
  */
 private function prepareCurl()
 {
     $curl = new Curl();
     $curl->setOption(CURLOPT_USERAGENT, 'B2BackblazeClient');
     $curl->setVerifyPeer(false);
     $curl->setTimeout($this->timeout);
     return $curl;
 }
Esempio n. 13
0
 /**
  * @param Curl $client
  * @param array $settings
  */
 private function setCurlOptions(Curl $client, array $settings)
 {
     foreach ($settings as $option => $value) {
         $client->setOption($option, $value);
     }
 }