Exemplo n.º 1
0
 /**
  * Initialise
  */
 protected function init()
 {
     $client = new Curl();
     $client->setVerifyPeer(false);
     $client->setOption(CURLOPT_SSLVERSION, 3);
     $this->browser = new Browser($client);
 }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
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;
 }
 private function createClientHttp()
 {
     $httpClient = new Curl();
     $httpClient->setVerifyPeer(true);
     $httpClient->setTimeout(10);
     $httpClient->setMaxRedirects(5);
     $httpClient->setIgnoreErrors(true);
     return $httpClient;
 }
Exemplo n.º 5
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);
 }
 private function getTweets($data)
 {
     //Creating data to call Twitter API
     $consumer_key = $this->container->getParameter('twitter_app_id');
     $consumer_secret = $this->container->getParameter('twitter_secret');
     $searchUrlParams = "";
     $curl = new Curl();
     $curl->setVerifyPeer(false);
     //Getting the search and all the options
     $searchParams = $data['searchParams'];
     $tabSearch = explode(" ", $searchParams);
     foreach ($tabSearch as $elem) {
         $searchUrlParams .= $elem;
     }
     $lang = $data['lang'];
     $resultType = $data['resultType'];
     //Getting tweets
     $client = new Browser($curl);
     $consumer = new Consumer($client, $consumer_key, $consumer_secret);
     //$consumer->setConverter('/1.1/search/tweets.json', new TwitterSearchConverter());
     $query = $consumer->prepare('/1.1/search/tweets.json', 'GET', array('q' => $searchUrlParams, 'lang' => $lang, 'resultType' => $resultType));
     $results = $consumer->execute($query);
     return $resultsDecode = json_decode(json_encode($results->toArray()));
 }
Exemplo n.º 8
0
 protected function request($url, $data = array(), $method = 'POST', array $headers = array())
 {
     if ($data instanceof Form) {
         $data = $data->toArray();
     }
     $client = new Curl();
     $client->setTimeout(100);
     $client->setVerifyPeer(FALSE);
     $browser = new Browser($client);
     $response = $browser->submit($url, $data, $method, $headers);
     return $response->getContent();
 }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
0
 /**
  * returns the Buzz Browser client
  *
  * @return \Buzz\Browser
  */
 protected function createClient()
 {
     $client = new Curl();
     $client->setVerifyPeer(false);
     $browser = new Browser($client);
     return $browser;
 }
Exemplo n.º 11
0
 /**
  * Creates the HTTP abstraction object hierarchy.
  * For this purpose we use an external library called "Buzz".
  *
  * For $instanceConfig documentation see self::getDataService.
  *
  * @param array $instanceConfig
  * @return Browser
  */
 protected static function getHTTPClientInstance(array $instanceConfig)
 {
     $username = isset($instanceConfig['Instance']['user']) === true ? $instanceConfig['Instance']['user'] : '';
     $password = isset($instanceConfig['Instance']['pass']) === true ? $instanceConfig['Instance']['pass'] : '';
     // Bootstrap the REST client
     $curlClient = new Curl();
     $curlClient->setVerifyPeer(false);
     $restClient = new Browser($curlClient);
     if ($username && $password) {
         $authListener = new BasicAuthListener($username, $password);
         $restClient->addListener($authListener);
     }
     return $restClient;
 }
Exemplo n.º 12
0
 /**
  * @param string $url
  * @param mixed  $method
  *
  * @return string
  */
 protected function httpRequest($url, $method = Request::METHOD_GET)
 {
     $curl = new Curl();
     $curl->setVerifyPeer(false);
     $buzz = new Browser($curl);
     $response = $buzz->call($url, $method);
     return $response->getContent();
 }