本文整理汇总了PHP中Guzzle\Http\Client::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::__construct方法的具体用法?PHP Client::__construct怎么用?PHP Client::__construct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Http\Client
的用法示例。
在下文中一共展示了Client::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($baseUrl = '', $config = null, $tokens = null)
{
if ($tokens) {
$this->setUserTokens($tokens);
}
parent::__construct($baseUrl, $config);
}
示例2: __construct
public function __construct($emailAddress, $apiToken, $apiUrl)
{
$this->emailAddress = $emailAddress;
$this->apiToken = $apiToken;
$this->apiUrl = $apiUrl;
parent::__construct($apiUrl, array('curl.options' => array('CURLOPT_FOLLOWLOCATION' => 1, 'CURLOPT_MAXREDIRS' => 10, 'CURLOPT_TIMEOUT' => 10, 'CURLOPT_USERPWD' => $emailAddress . '/token:' . $apiToken)));
$this->setDefaultHeaders(array('Content-type' => 'application/json', 'User-Agent' => 'MozillaXYZ/1.0'));
}
示例3: __construct
public function __construct($api_key, $url = 'https://bigboard.us')
{
parent::__construct();
$this->setBaseUrl($url);
$this->setSslVerification(false, false, false);
$this->setUserAgent("BigBoardSDK/0.1");
$this->setDefaultOption('headers', array('X-BigBoard-Token' => $api_key, 'Content-Type' => "text/json"));
}
示例4: __construct
public function __construct($baseUrl = '', $config = null)
{
// @codeCoverageIgnoreStart
if (PHP_VERSION < self::MINIMUM_PHP_VERSION) {
throw new UnsupportedVersionError(sprintf('You must have PHP version >= %s installed.', self::MINIMUM_PHP_VERSION));
}
// @codeCoverageIgnoreEnd
parent::__construct($baseUrl, $config);
}
示例5: __construct
/**
* Public constructor.
*
* Enables backoff support.
*
* @param string $baseUrl Base URL of the web service.
* @param string $backoffRegex Optional error pattern to
* search for in response bodies.
*/
public function __construct($baseUrl = '', $backoffRegex = null)
{
if (is_string($backoffRegex)) {
$backoffPlugin = new BackoffPlugin(new ResponseMatchesBackoffStrategy($backoffRegex));
} else {
$backoffPlugin = BackoffPlugin::getExponentialBackoff();
}
$config = array('request.options' => array('plugins' => array($backoffPlugin)));
parent::__construct($baseUrl, $config);
}
示例6: __construct
public function __construct($baseUrl = '', $config = null, ProviderInterface $provider = null, AccessToken $tokens = null)
{
if ($tokens) {
$this->setUserTokens($tokens);
}
if ($provider) {
$this->setProvider($provider);
}
parent::__construct($baseUrl, $config);
}
示例7: __construct
/**
* Build a new Http request
* @param array $auth [apikey, apisecret]
* @param string $method http method
* @param string $url call url
* @param array $filters Mailjet resource filters
* @param array $body Mailjet resource body
* @param string $type Request Content-type
*/
public function __construct($auth, $method, $url, $filters, $body, $type)
{
parent::__construct();
$this->setUserAgent(Config::USER_AGENT . phpversion() . '/' . Client::WRAPPER_VERSION);
$this->type = $type;
$this->auth = $auth;
$this->method = $method;
$this->url = $url;
$this->filters = $filters;
$this->body = $body;
}
示例8: __construct
/**
* @param array $config
* @param string|null $proxy
*/
public function __construct(array $config, $proxy = null)
{
$defaults = ['base_url' => 'https://btc-e.com/'];
$required = ['base_url', 'api_key', 'api_secret'];
if (null !== $proxy) {
$defaults[self::REQUEST_OPTIONS] = ['proxy' => $proxy, 'verify' => false];
}
$config = Collection::fromConfig($config, $defaults, $required);
$this->apiKey = $config->get('api_key');
$this->apiSecret = $config->get('api_secret');
$config->set('exceptions', false);
parent::__construct($config->get('base_url'), $config);
}
示例9: __construct
public function __construct($token)
{
$url = sprintf($token);
parent::__construct($url);
//$this->setDefaultOption('query', array('token' => $token));
}
示例10: __construct
public function __construct()
{
parent::__construct(Keyring::getAppUrlRegion());
}
示例11: __construct
public function __construct($baseUrl)
{
parent::__construct($baseUrl);
}
示例12: __construct
public function __construct($team, $token)
{
$url = sprintf("https://%s.slack.com", $team);
parent::__construct($url);
$this->setDefaultOption('query', array('token' => $token));
}
示例13: __construct
public function __construct(array $config = array())
{
parent::__construct('', $config);
$this->config = array_merge($this->config, $config);
}
示例14: __construct
public function __construct($baseUrl = '', $config = null)
{
parent::__construct($baseUrl, $config);
$cookiePlugin = new CookiePlugin(new ArrayCookieJar());
$this->addSubscriber($cookiePlugin);
}
示例15: __construct
public function __construct($baseUrl)
{
parent::__construct();
$this->setUserAgent(self::USER_AGENT);
$this->setBaseUrl($baseUrl);
}