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


PHP Client::setDefaultOption方法代码示例

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


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

示例1: __construct

 /**
  * Initializes the BeHat context for every scenario
  *
  * @param array $parameters Context parameters defined in behat.yml (default.context.parameters...)
  */
 public function __construct(array $parameters)
 {
     $this->client = new \Guzzle\Service\Client();
     $this->client->setDefaultOption('exceptions', false);
     // disable exceptions: we want to test error responses
     self::$parameters = $parameters;
     $this->restObj = new \stdClass();
 }
开发者ID:tecnickcom,项目名称:tc-lib-testrest,代码行数:13,代码来源:BaseContext.php

示例2: setSignature

 public function setSignature($path, $arr = array())
 {
     $nonce = time();
     $url = $this->apiBase . $path;
     $message = $nonce . $url . http_build_query($arr);
     $signature = hash_hmac("sha256", $message, $this->secretKey);
     $this->client->setDefaultOption('headers/ACCESS-NONCE', $nonce);
     $this->client->setDefaultOption('headers/ACCESS-SIGNATURE', $signature);
 }
开发者ID:augur0781,项目名称:coincheck-php,代码行数:9,代码来源:Coincheck.php

示例3: logOnClient

 /**
  * Authenticate to the API
  * 
  * @return boolean
  */
 private function logOnClient()
 {
     $logOnRequest = new LogOnRequest();
     $logOnRequest->UserName = $this->config->getUserName();
     $logOnRequest->Password = $this->config->getPassword();
     $LogOnResponse = $this->client->logOn($logOnRequest->jsonSerialize());
     if ($LogOnResponse->IsSuccess) {
         $this->setHeader('SecurityToken', $LogOnResponse->SecurityToken);
         $this->client->setDefaultOption('headers', $this->getHeaders());
         return true;
     } else {
         return false;
     }
 }
开发者ID:opifer,项目名称:smarteventmanager,代码行数:19,代码来源:Client.php

示例4: execute

 /**
  * Performs the API Call to PostMarkApp using GuzzlePHP
  *
  * @param $type
  *
  * @return string
  */
 private function execute($type)
 {
     $client = new Client($this->_api_url);
     $client->setDefaultOption("headers", array('X-Postmark-Server-Token' => $this->_credentials, 'Accept' => 'application/json', 'Content-Type' => ' application/json'));
     $url = "";
     switch ($type) {
         case "SEND":
             $url = $this->_api_send_url;
             break;
         case "BATCH":
             $url = $this->_api_batch_url;
     }
     $request = $client->post($url, null, json_encode($this->_send_object));
     return $request->send()->json();
 }
开发者ID:abishekrsrikaanth,项目名称:mailto,代码行数:22,代码来源:PostMark.php

示例5: getClient

 /**
  * Get guzzle client
  * @return Client
  */
 public function getClient()
 {
     if ($this->client instanceof Client) {
         return $this->client;
     }
     $client = new Client();
     $client->setDefaultOption('verify', false);
     return $client;
 }
开发者ID:n8b,项目名称:VMN,代码行数:13,代码来源:UrlHandler.php

示例6: docUploadTestAction

 public function docUploadTestAction()
 {
     $client = new Client('https://lossync.sudoux.com/losService.svc', array('ssl.certificate_authority' => false));
     $client->setDefaultOption('auth', array('dan', 'letmein!789', 'Basic'));
     /*$user = array(
           'AuthUser' => array(
               'uri' => 'https://lossync.sudoux.com/losService.svc',
               'username' => 'dan',
               'password' =>
           ),
           'lostype' => 0,
           'apiKey' => 'AAKLPCALBX',
       );*/
     $filePath = $this->container->get('kernel')->getRootDir() . '/../web/fff.jpg';
     if (!is_file($filePath)) {
         $e = new \Exception('Local file not found');
         $this->logger->crit($e->getMessage());
         throw $e;
     }
     // first upload the file
     $params = array('file' => '@' . $filePath);
     //  $request = $client->post('uploadFile');
     // Set the body of the POST to stream the contents of /path/to/large_body.txt
     //    $request->setBody(fopen('/path/to/large_body.txt', 'r'));
     //   $response = $request->send();
     $request = $client->post('uploadFile');
     $request->setBody(fopen($filePath, 'r'));
     $response = $request->send();
     $data = $response->json();
 }
开发者ID:eric19h,项目名称:turbulent-wookie,代码行数:30,代码来源:LoanTestController.php

示例7: setAcceptLanguage

 public function setAcceptLanguage($value)
 {
     $this->client->setDefaultOption('headers/Accept-Language', $value);
 }
开发者ID:kojiyamauchi,项目名称:WebPayAndPayPalAPISampleInWordPress,代码行数:4,代码来源:WebPay.php

示例8: setDefaultOption

 /**
  * @param string $keyOrPath
  * @param mixed  $value
  *
  * @return $this
  */
 public function setDefaultOption($keyOrPath, $value)
 {
     return parent::setDefaultOption($keyOrPath, $value);
 }
开发者ID:orukusaki,项目名称:slackbundle,代码行数:10,代码来源:Client.php


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