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


PHP Client::__construct方法代码示例

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


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

示例1: __construct

 /**
  * Constructor.
  * 
  * @param string $xApiKey
  *   An api.data.gov api key that is granted to your user.
  *
  * @param string $xAdminAuthToken
  *   Admin Authorization Token provided by api.data.gov admin accounts.
  */
 public function __construct($xApiKey, $xAdminAuthToken)
 {
     parent::__construct(['base_url' => $this->apiUrl]);
     $this->xApiKey = $xApiKey;
     $this->xAdminAuthToken = $xAdminAuthToken;
     $this->setDefaultOption('headers', array('X-Api-Key' => $this->xApiKey, 'X-Admin-Auth-Token' => $this->xAdminAuthToken, 'Content-Type' => 'application/json', 'Accept' => 'text/*'));
 }
开发者ID:mvogelgesang,项目名称:data_gov_admin_api,代码行数:16,代码来源:dataDotGovAdminAPI_SDK.php

示例2: __construct

 /**
  * Client constructor.
  */
 public function __construct(array $config = [])
 {
     $vindi = new Vindi();
     $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
     $config = array_merge(['base_uri' => Vindi::$apiBase, 'auth' => [$vindi->getApiKey(), '', 'BASIC'], 'headers' => ['Content-Type' => 'application/json', 'User-Agent' => trim('Vindi-PHP/' . Vindi::$sdkVersion . "; {$host}")], 'verify' => $vindi->getCertPath(), 'timeout' => 60, 'curl.options' => ['CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1_2']], $config);
     parent::__construct($config);
 }
开发者ID:vindi,项目名称:vindi-php,代码行数:10,代码来源:Client.php

示例3: __construct

 public function __construct($base_uri, $username, $access_token)
 {
     parent::__construct(['base_uri' => $base_uri]);
     $this->access_token = $access_token;
     $this->username = $username;
     $this->auth = new Authentication($this);
 }
开发者ID:robindotnet2010,项目名称:vtiger_php,代码行数:7,代码来源:HttpClient.php

示例4: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     $this->token = true;
     $this->ph_session = (new \Phalcon\DI())->getDefault()->getSession();
     $this->base_url = getenv('API_URL');
 }
开发者ID:ricky49,项目名称:darr_webpage,代码行数:10,代码来源:SDK.php

示例5: __construct

 /**
  * Constructor
  *
  * @param string $version version number (v0)
  */
 public function __construct($version = null)
 {
     if ($version) {
         $this->version = $version;
     }
     parent::__construct(['base_url' => implode("/", [self::API_BASE_URL, $this->version, ''])]);
 }
开发者ID:traviskuhl,项目名称:hn-php,代码行数:12,代码来源:Client.php

示例6: __construct

 /**
  * @param Endpunkt $endpoint API-Endpunkt
  * @param string $userAgent User-Agent
  * @param string $token API-Token
  * @param string $user Benutzername
  * @param string $password Passwort
  * @param bool $compress Komprimierung aktivieren
  * @param bool $verify SSL-Zertifikate verifizieren
  */
 public function __construct(Endpunkt $endpoint, $userAgent, $token, $user, $password, $compress = false, $verify = true)
 {
     parent::__construct(['base_url' => $endpoint->getBaseUrl()]);
     if (!$userAgent) {
         throw new \InvalidArgumentException('User-Agent erforderlich.');
     }
     if (!$token) {
         throw new \InvalidArgumentException('Token erforderlich.');
     }
     if (!$user) {
         throw new \InvalidArgumentException('Benutzername erforderlich.');
     }
     if (!$password) {
         throw new \InvalidArgumentException('Passwort erforderlich.');
     }
     $headers = ['User-Agent' => sprintf('%1$s; Token=%2$s', $userAgent, $token)];
     if ($compress) {
         $headers['Accept-Encoding'] = 'gzip';
     }
     $this->setDefaultOption('headers', $headers);
     $this->setDefaultOption('auth', [$user, $password]);
     $this->setDefaultOption('verify', $verify);
     if ($compress) {
         $this->setDefaultOption('decode_content', true);
     } else {
         $this->setDefaultOption('decode_content', false);
     }
     $this->endpoint = $endpoint;
 }
开发者ID:afk,项目名称:esv-client-php,代码行数:38,代码来源:HttpClient.php

示例7: __construct

 /**
  * Sets up our client vars and initialises the base_uri on the
  * GuzzleHttp Client instance.
  *
  * @param string  $key       Google Places API key
  * @param array   $location  Latitude/Longitude pair
  * @param array   $options   Options for refining the search.
  */
 public function __construct($key, array $location, $options = [])
 {
     $this->key = $key;
     $this->location = $location;
     $this->options = $options;
     parent::__construct(['base_uri' => $this->endpoint]);
 }
开发者ID:philkershaw,项目名称:google-places,代码行数:15,代码来源:NearBySearch.php

示例8: __construct

 /**
  * @param string $apiKey  The API key for your ThisData account
  * @param int    $version The version of the ThisData API to use
  * @param array  $options Extra options for the GuzzleClient
  */
 public function __construct($apiKey, $version = 1, array $options = [])
 {
     $this->apiKey = $apiKey;
     $this->version = $version;
     $options = array_merge($this->getDefaultConfiguration(), $options);
     parent::__construct($options);
 }
开发者ID:thisdata,项目名称:thisdata-php,代码行数:12,代码来源:Client.php

示例9: __construct

 /**
  * @param array $accessToken
  * @param string $version
  * @param array $config
  */
 public function __construct($accessToken, $version = 'v2.6', array $config = [])
 {
     $this->accessToken = $accessToken;
     $this->version = $version;
     $config = array_merge(['base_uri' => $this->baseUri, 'query' => ['access_token' => $this->accessToken]], $config);
     parent::__construct($config);
 }
开发者ID:madewithlove,项目名称:facebook-messenger-platform,代码行数:12,代码来源:HttpClient.php

示例10: __construct

 /**
  * @param Client $client
  */
 public function __construct(Client $client)
 {
     $this->client = $client;
     $this->testing = $this->client->isTesting();
     $this->options = array('query' => array('lang' => $this->client->getLocale()));
     parent::__construct(array('base_url' => array($this->client->getUrl() . '/{version}/', array('version' => $this->client->getVersion()))));
 }
开发者ID:bramdevries,项目名称:guildwars2-php-api,代码行数:10,代码来源:AbstractEndpoint.php

示例11: __construct

 /**
  * @param AccessTokenInterface $token
  * @param array $options
  */
 public function __construct(AccessTokenInterface $token, array $options = [])
 {
     $options = array_merge($options, ['emitter' => EventsManager::getEmitter()]);
     parent::__construct($options);
     if ($token instanceof OAuth2AccessTokenInterface) {
         $this->getEmitter()->on('before', function (BeforeEvent $event) use($token) {
             /** @var \Eva\EvaOAuth\OAuth2\Token\AccessToken $token */
             $event->getRequest()->setHeader('Authorization', $token->getTokenType() . ' ' . $token->getTokenValue());
         });
     } else {
         $signatureMethod = isset($options['signature_method']) ? $options['signature_method'] : SignatureInterface::METHOD_HMAC_SHA1;
         $signatureClasses = [SignatureInterface::METHOD_PLAINTEXT => 'Eva\\EvaOAuth\\OAuth1\\Signature\\PlainText', SignatureInterface::METHOD_HMAC_SHA1 => 'Eva\\EvaOAuth\\OAuth1\\Signature\\Hmac', SignatureInterface::METHOD_RSA_SHA1 => 'Eva\\EvaOAuth\\OAuth1\\Signature\\Rsa'];
         if (false === isset($signatureClasses[$signatureMethod])) {
             throw new InvalidArgumentException(sprintf('Signature method %s not able to process', $signatureMethod));
         }
         $signatureClass = $signatureClasses[$signatureMethod];
         $this->getEmitter()->on('before', function (BeforeEvent $event) use($token, $signatureClass) {
             /** @var Request $request */
             $request = $event->getRequest();
             /** @var \Eva\EvaOAuth\OAuth1\Token\AccessToken $token */
             $httpMethod = strtoupper($request->getMethod());
             $url = Url::fromString($request->getUrl());
             $parameters = ['oauth_consumer_key' => $token->getConsumerKey(), 'oauth_signature_method' => SignatureInterface::METHOD_HMAC_SHA1, 'oauth_timestamp' => (string) time(), 'oauth_nonce' => strtolower(Text::generateRandomString(32)), 'oauth_token' => $token->getTokenValue(), 'oauth_version' => '1.0'];
             $signature = (string) new $signatureClass($token->getConsumerSecret(), Text::buildBaseString($httpMethod, $url, $parameters), $token->getTokenSecret());
             $parameters['oauth_signature'] = $signature;
             $event->getRequest()->setHeader('Authorization', Text::buildHeaderString($parameters));
         });
     }
 }
开发者ID:assad2012,项目名称:EvaOAuth,代码行数:33,代码来源:AuthorizedHttpClient.php

示例12: __construct

 /**
  * @param KeyValueStore $kvs
  * @param string  $clientId
  * @param string $clientSecret
  * @param string $redirectUri
  */
 public function __construct(KeyValueStore $kvs, $clientId, $clientSecret, $redirectUri)
 {
     $this->kvs = $kvs;
     $this->clientId = $clientId;
     $this->clientSecret = $clientSecret;
     $this->redirectUri = $redirectUri;
     parent::__construct();
 }
开发者ID:noxfate,项目名称:gathercloud,代码行数:14,代码来源:OAuthClient.php

示例13: __construct

 /**
  * GuzzleWrapper constructor.
  * @param $client
  */
 public function __construct(array $config)
 {
     $config['on_stats'] = function (TransferStats $stats) {
         // contient les stats
         $stats->getHandlerStats();
     };
     parent::__construct($config);
 }
开发者ID:LinkValue,项目名称:MajoraApiClientBundle,代码行数:12,代码来源:GuzzleWrapper.php

示例14: __construct

 public function __construct($parameters)
 {
     parent::__construct();
     $this->url = $parameters['url'];
     $this->version = $parameters['version'];
     $this->id = $parameters['id'];
     $this->sslVerficationEnabled = $parameters['sslVerifcationEnabled'];
 }
开发者ID:thomaswiener,项目名称:client-amsbus,代码行数:8,代码来源:Client.php

示例15: __construct

 /**
  * Client constructor.
  * @param array $config
  */
 public function __construct($config = [])
 {
     $config = new Config($config);
     if (!$config->hasRequired()) {
         throw new NotExistRequiredException();
     }
     parent::__construct($config->toGuzzleConfig());
 }
开发者ID:ochi51,项目名称:cybozu-http,代码行数:12,代码来源:Client.php


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