当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::setSslVerification方法代码示例

本文整理汇总了PHP中Guzzle\Http\Client::setSslVerification方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::setSslVerification方法的具体用法?PHP Client::setSslVerification怎么用?PHP Client::setSslVerification使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guzzle\Http\Client的用法示例。


在下文中一共展示了Client::setSslVerification方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setGuzzle

 /**
  * @param \Guzzle\Http\Client $guzzle
  * @return void
  */
 public function setGuzzle(Client $guzzle)
 {
     $this->guzzle = $guzzle;
     $this->guzzle->setSslVerification(false, false);
     $this->guzzle->setUserAgent('User-Agent: Mozilla/5.0 (Linux; U; Android 4.3; EN; C6502 Build/10.4.1.B.0.101) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 PlayStation App/1.60.5/EN/EN');
     $this->guzzle->addSubscriber(new CookiePlugin(new ArrayCookieJar()));
 }
开发者ID:grit45,项目名称:gumer-psn-php,代码行数:11,代码来源:Connection.php

示例2: sendValidationRequest

 /**
  * {@inheritdoc}
  */
 public function sendValidationRequest($uri)
 {
     try {
         $this->guzzleClient->setSslVerification($this->serverCaValidation);
         $request = $this->guzzleClient->get($uri);
         $response = $request->send();
         return (string) $response->getBody();
     } catch (RuntimeException $e) {
         throw new ValidationException("Validation request to CAS server failed with message: " . $e->getMessage());
     }
 }
开发者ID:PrincetonUniversity,项目名称:PucsCasAuthBundle,代码行数:14,代码来源:GuzzleRequest.php

示例3: __construct

 /**
  * @param string $username
  * @param string $password
  * @param string $country
  *
  * @throws Exception
  */
 public function __construct($username, $password, $country = 'DE')
 {
     $this->_username = $username;
     $this->_password = $password;
     $this->_country = $country;
     if (!array_key_exists($country, $this->_hostNames)) {
         throw new Exception('No hostname for the given country available.');
     }
     $this->_host = $this->_hostNames[$country];
     $this->_client = new HttpClient('https://' . $this->_host . '/');
     $this->_client->setSslVerification(false, false, 0);
     $this->_client->setUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17', true);
     $cookiePlugin = new CookiePlugin(new ArrayCookieJar());
     $this->_client->addSubscriber($cookiePlugin);
     $this->_login();
 }
开发者ID:seofood,项目名称:amazon-revenue,代码行数:23,代码来源:Client.php

示例4: setSslCertificate

 /**
  * Seta o caminho para o arquivo certificado SSL (ex.: certificado.crt)
  *
  * @access public
  * @param  string $sslCertificate
  * @return Cielo
  */
 public function setSslCertificate($sslCertificate = '')
 {
     if (!is_string($sslCertificate) || trim($sslCertificate) != '' && !is_readable($sslCertificate)) {
         throw new InvalidArgumentException('Parâmetro inválido.');
     }
     if ($sslCertificate != '') {
         $this->httpClient->setSslVerification($sslCertificate, true, 2);
     } else {
         $this->httpClient->setSslVerification(false);
     }
     return $this;
 }
开发者ID:mrprompt,项目名称:cielo,代码行数:19,代码来源:Cliente.php

示例5: getGitData

 protected function getGitData($git)
 {
     $client = new Client('https://api.github.com');
     $client->setSslVerification(false);
     $request = $client->get('/repos/' . $git);
     $response = $request->send();
     $contents = $response->getBody();
     $content = json_decode($contents);
     $content = get_object_vars($content);
     $owner = $content['owner'];
     $owner = get_object_vars($owner);
     $dataGit = array('git' => $git, 'author' => $owner['login'], 'repo' => $content['name'], 'description' => $content['description'], 'star' => $content['stargazers_count'], 'fork' => $content['forks_count'], 'readme' => $this->getReadme($git));
     return $dataGit;
 }
开发者ID:krisanalfa,项目名称:xinix-showcase,代码行数:14,代码来源:ShowcaseObserver.php

示例6: request

 /**
  * @param string $method
  * @param string $url
  * @param array|null $data
  * @param string|null $namespace
  * @param bool $anonymous
  * @param string|null $name
  * @return mixed
  * @throws ApiException
  * @throws \Exception
  */
 protected function request($method, $url, array $data = null, $namespace = null, $anonymous = false, $name = null)
 {
     try {
         $client = new Client($this->baseUrl);
         $client->setSslVerification(self::SSL_CERTIFICATE_CHECK);
         $method = strtolower($method);
         // returns the raw body
         if ($method === 'download') {
             return $this->processDownload($client, $url, $data, $anonymous);
         }
         $parameters = ['Accept' => 'application/json'];
         if (!$anonymous) {
             $parameters['Authorization'] = 'Bearer ' . $this->accessToken;
         }
         $options = ['debug' => false];
         $payload = null;
         if ($method === 'get' || $method === 'upload') {
             if ($method === 'get') {
                 $options['query'] = $data;
             } else {
                 if (!isset($data['file'])) {
                     throw new \Exception('This method requires a file parameter');
                 }
                 $payload = ['file' => '@' . $data['file']];
             }
         } else {
             $parameters['Content-Type'] = 'application/json';
             $payload = json_encode($data);
         }
         $response = $this->executeRequest($client, $method, $url, $parameters, $options, $payload);
         $content = $response->getBody(true);
         if ($response->getStatusCode() < 200 && $response->getStatusCode() >= 300) {
             throw new ApiException('', $response->getStatusCode(), $url, $method, $content);
         }
         $ret = json_decode($content);
         if ($ret === false) {
             throw new ApiException('Response is invalid json', 200, $url, $method, $content);
         }
         // on login, store the access token
         if ($name === 'login') {
             $this->setAccessToken($ret->access_token, $ret->expires_in + time(), $ret->refresh_token);
         }
         if ($namespace && !isset($ret->count)) {
             return $ret->{$namespace};
         }
         return $ret;
     } catch (BadResponseException $e) {
         throw new ApiException($e->getMessage(), $e->getResponse()->getStatusCode(), $url, $method, $e->getResponse()->getBody(true));
     }
 }
开发者ID:stamplia,项目名称:stamplia-php,代码行数:61,代码来源:ApiClient.php

示例7: testClientPreventsInvalidVerifyPeerSetting

 /**
  * @expectedException Guzzle\Common\Exception\InvalidArgumentException
  */
 public function testClientPreventsInvalidVerifyPeerSetting()
 {
     // set a file other than the provided cacert.pem
     $client = new Client('https://www.secure.com/', array('api' => 'v1'));
     $client->setSslVerification(__FILE__, 'yes');
 }
开发者ID:carlesgutierrez,项目名称:libreobjet.org,代码行数:9,代码来源:ClientTest.php

示例8: run

 /**
  * Runs a program.
  *
  * @param string $program
  * @throws \RuntimeException if there is a virtualmin error
  * @param array $options
  * @return array results
  */
 public function run($program, array $options = [])
 {
     $options['program'] = $program;
     $options['multiline'] = '';
     $options['json'] = '1';
     $client = new Client('https://' . $this->host . ':' . $this->port);
     $client->setSslVerification(false);
     $request = $client->get('/virtual-server/remote.cgi', [], ['query' => $options]);
     $request->setAuth($this->username, $this->password);
     $response = json_decode($request->send()->getBody(), true);
     if ($response['status'] !== 'success') {
         throw new \RuntimeException($response['error']);
     }
     if (isset($response['data'])) {
         return $response['data'];
     } else {
         return $response;
     }
 }
开发者ID:rickogden,项目名称:Virtualmin-PHP,代码行数:27,代码来源:Virtualmin.php

示例9: _execute

 protected function _execute()
 {
     $login = Config::get('payto::gateways.nmi.login');
     $password = Config::get('payto::gateways.nmi.password');
     $env = Config::get('payto::gateways.nmi.environment');
     if (empty($login)) {
         if ($env != "sandbox") {
             throw new ProviderException("The Login is missing");
         } else {
             $this->_requestData['username'] = "demo";
         }
     } else {
         $this->_requestData['username'] = $env == "sandbox" ? "demo" : $login;
     }
     if (empty($password)) {
         if ($env != "sandbox") {
             throw new ProviderException("The Password is missing");
         } else {
             $this->_requestData['password'] = "password";
         }
     } else {
         $this->_requestData['password'] = $env == "sandbox" ? "password" : $password;
     }
     $client = new Client($this->_apiUrl, array('curl.options' => array('CURLOPT_SSLVERSION' => '3')));
     $client->setSslVerification(false, false, 0);
     $request = $client->post($this->_apiUrl, array(), $this->_requestData);
     return $request->send()->getBody(true);
 }
开发者ID:abishekrsrikaanth,项目名称:payto,代码行数:28,代码来源:NMI.php


注:本文中的Guzzle\Http\Client::setSslVerification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。