Example #1
0
 /**
  * @param string $host
  * @param string $resource
  * @return string
  *   Return the response body from the HTTP request
  */
 public function doRequest($host, $resource)
 {
     if (!($cookieJar = $this->cache->fetch('wesnick.ringcentral.cookies'))) {
         $cookieJar = new CookieJar();
     }
     $client = new FileGetContents($cookieJar);
     $request = new Request(Request::METHOD_GET, $resource, $host);
     $response = new Response();
     $client->setVerifyPeer(false);
     $client->send($request, $response);
     $this->cache->save('wesnick.ringcentral.cookies', $client->getCookieJar());
     return $response->getContent();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function createClient(array $config = [])
 {
     if (!class_exists('Http\\Adapter\\Buzz\\Client')) {
         throw new \LogicException('To use the Buzz adapter you need to install the "php-http/buzz-adapter" package.');
     }
     $client = new FileGetContents();
     $options = $this->getOptions($config);
     $client->setTimeout($options['timeout']);
     $client->setVerifyPeer($options['verify_peer']);
     $client->setVerifyHost($options['verify_host']);
     $client->setProxy($options['proxy']);
     return new Adapter($client, $this->messageFactory);
 }
 /**
  * @return Curl|FileGetContents
  */
 public static function getClient()
 {
     if (in_array('curl', get_loaded_extensions())) {
         $client = new Curl();
     } else {
         $client = new FileGetContents();
     }
     $client->setVerifyPeer(false);
     $client->setVerifyHost(false);
     return $client;
 }