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


PHP Client::getBaseUrl方法代码示例

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


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

示例1: send

 /**
  * Send data to remote JSON-RPC service over HTTP.
  *
  * @throws \Josser\Exception\TransportFailureException
  * @param mixed $data
  * @return string
  */
 public function send($data)
 {
     try {
         $response = $this->guzzle->post(null, ['body' => $data, 'headers' => ['Content-Type' => 'application/json']]);
         return $response->getBody()->getContents();
     } catch (\Exception $e) {
         $error = sprintf('JSON-RPC http connection failed. Remote service at "%s" is not responding.', $this->guzzle->getBaseUrl());
         throw new TransportFailureException($error, null, $e);
     }
 }
开发者ID:alanbem,项目名称:josser,代码行数:17,代码来源:Guzzle5Transport.php

示例2: __construct

 /**
  * SharePoint Site constructor
  *
  * @access  public
  * @param   \GuzzleHttp\Client $http   Guzzle HTTP client
  * @param   array              $config SharePoint Site configuration
  * @throws  SPException
  * @return  SPSite
  */
 public function __construct(Client $http, array $config)
 {
     $this->config = array_replace_recursive(['acs' => static::ACS], $config);
     // set Guzzle HTTP client
     $this->http = $http;
     // set Site Hostname and Path
     $components = parse_url($this->http->getBaseUrl());
     if (!isset($components['scheme'], $components['host'], $components['path'])) {
         throw new SPException('The SharePoint Site URL is invalid');
     }
     $this->hostname = $components['scheme'] . '://' . $components['host'];
     $this->path = rtrim($components['path'], '/');
 }
开发者ID:aroberson,项目名称:sharepoint-oauth-app-client,代码行数:22,代码来源:SPSite.php

示例3: __construct

 public function __construct($id, $token, Client $client = null)
 {
     if (!$client) {
         $client = new Client(['base_url' => self::ENDPOINT]);
     }
     if (!$client->getBaseUrl()) {
         throw new Exception\ClientException('API client is not configured with a base URL');
     }
     if (!ctype_xdigit($id) || !ctype_xdigit($token)) {
         throw new Exception\ClientException('User credentials are invalid');
     }
     $client->setDefaultOption('headers', ['Auth' => "Bearer {$id} {$token}", 'User-Agent' => 'WIU PHP Client/1.0']);
     $this->client = $client;
 }
开发者ID:wondernetwork,项目名称:wiuphp,代码行数:14,代码来源:API.php

示例4: testCanSpecifyBaseUrlUriTemplate

 public function testCanSpecifyBaseUrlUriTemplate()
 {
     $client = new Client(['base_url' => ['http://foo.com/{var}/', ['var' => 'baz']]]);
     $this->assertEquals('http://foo.com/baz/', $client->getBaseUrl());
 }
开发者ID:mahersafadi,项目名称:joindin-api,代码行数:5,代码来源:ClientTest.php

示例5: jsonSerialize

 /**
  * Implements \JsonSerializable::jsonSerialize.
  */
 public function jsonSerialize()
 {
     return ['url' => $this->client->getBaseUrl(), 'username' => $this->username, 'password' => $this->password, 'authToken' => $this->authToken, 'accessToken' => $this->accessToken, 'refreshToken' => $this->refreshToken, 'settings' => $this->settings];
 }
开发者ID:dividebv,项目名称:phpdivideiq,代码行数:7,代码来源:DivideIQ.php

示例6: getBaseUri

 public function getBaseUri()
 {
     return $this->client->getBaseUrl();
 }
开发者ID:canaltp,项目名称:abstract-guzzle,代码行数:4,代码来源:Guzzle5.php

示例7: copyClientDefaults

 /**
  * @param Client $client
  */
 protected function copyClientDefaults(Client $client)
 {
     $this->request->setUrl($client->getBaseUrl() . $this->request->getUrl());
     $this->request->addHeaders($client->getDefaultOption('headers'));
 }
开发者ID:mahsanamin,项目名称:box-php-sdk,代码行数:8,代码来源:AbstractCommand.php


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