當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。