Пример #1
0
 protected function getCurlClient()
 {
     $client = new \Buzz\Client\Curl();
     $client->setTimeout(5);
     $client->setVerifyPeer(false);
     $client->setMaxRedirects(0);
     $client->setOption(\CURLOPT_CONNECTTIMEOUT, 3);
     $client->setOption(\CURLOPT_USERAGENT, "baidu-apiclient-php-2.0");
     $client->setOption(\CURLOPT_HTTP_VERSION, \CURL_HTTP_VERSION_1_1);
     $client->setOption(\CURLOPT_POST, false);
     return $client;
 }
Пример #2
0
 /**
  * Constructor
  * @param string $sBaseUrl
  * @param \Buzz\Client\ClientInterface $oHttpClient
  */
 public function __construct($sBaseUrl = null, \Buzz\Client\ClientInterface $oHttpClient = null)
 {
     if ($sBaseUrl) {
         $this->setBaseUrl($sBaseUrl);
     }
     if (!$oHttpClient) {
         $oHttpClient = new \Buzz\Client\Curl();
     }
     $oHttpClient->setTimeout($this->getOptions('timeout'));
     $oHttpClient->setVerifyPeer(false);
     $this->setHttpClient(new \GitlabCI\HttpClient\HttpClient($this->getBaseUrl(), $this->options, $oHttpClient));
 }
Пример #3
0
function sendRoomNotification($room, $msg)
{
    LogMe("Sending message to room {$room}: {$msg}");
    $auth = new GorkaLaucirica\HipchatAPIv2Client\Auth\OAuth2(getAuth($room));
    $browserclient = new Buzz\Client\Curl();
    $browserclient->setVerifyPeer(false);
    $browser = new Buzz\Browser($browserclient);
    $client = new GorkaLaucirica\HipchatAPIv2Client\Client($auth, $browser);
    $message = new \GorkaLaucirica\HipchatAPIv2Client\Model\Message();
    $message->setMessage($msg['msg']);
    $message->setMessageFormat('text');
    if (isset($msg['color'])) {
        $message->setColor($msg['color']);
    }
    $x = new GorkaLaucirica\HipchatAPIv2Client\API\RoomAPI($client);
    $ret = $x->sendRoomNotification($room, $message);
    LogMe(print_r($ret, true));
}
 /**
  * Gets the 'sonata.media.buzz.connector.curl' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return Buzz\Client\Curl A Buzz\Client\Curl instance.
  */
 protected function getSonata_Media_Buzz_Connector_CurlService()
 {
     $this->services['sonata.media.buzz.connector.curl'] = $instance = new \Buzz\Client\Curl();
     $instance->setIgnoreErrors(true);
     $instance->setMaxRedirects(5);
     $instance->setTimeout(5);
     $instance->setVerifyPeer(true);
     $instance->setProxy(NULL);
     return $instance;
 }
Пример #5
0
 private function getDocument($uri)
 {
     // Create a CURL client
     $cURL = new \Buzz\Client\Curl();
     $cURL->setVerifyPeer(false);
     $cURL->setTimeout(30);
     // Get discovery document
     $browser = new \Buzz\Browser($cURL);
     $response = $browser->get(\URL::to($uri));
     // Document content
     return $response->getContent();
 }
 /**
  * Gets the 'hwi_oauth.http_client' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Buzz\Client\Curl A Buzz\Client\Curl instance.
  */
 protected function getHwiOauth_HttpClientService()
 {
     $this->services['hwi_oauth.http_client'] = $instance = new \Buzz\Client\Curl();
     $instance->setVerifyPeer(true);
     $instance->setTimeout(5);
     $instance->setMaxRedirects(5);
     $instance->setIgnoreErrors(true);
     return $instance;
 }
Пример #7
0
 protected function processFormRequest(\Buzz\Message\Form\FormRequest $request)
 {
     $response = new \Buzz\Message\Response();
     $client = new \Buzz\Client\Curl();
     if ('test' == $this->ogoneEnv) {
         $client->setVerifyPeer(false);
     }
     $client->setTimeout(30);
     $client->send($request, $response);
     return $response;
 }