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


PHP ClientInterface::requestAsync方法代码示例

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


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

示例1: notifyGuzzle6

 /**
  * Notifies the YooChoose API using Guzzle 6 asynchronously.
  *
  * @param array $events
  */
 private function notifyGuzzle6(array $events)
 {
     $promise = $this->guzzle->requestAsync('POST', $this->getNotificationEndpoint(), array('json' => array('transaction' => null, 'events' => $events), 'auth' => array($this->options['customer-id'], $this->options['license-key'])));
     if (isset($this->logger)) {
         $this->logger->debug('Got asynchronously ' . $promise->getState() . ' from YooChoose notification POST');
     }
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:12,代码来源:YooChooseNotifier.php

示例2: create

 /**
  * Create an instance of SoapClientInterface asynchronously.
  *
  * @param ClientInterface $client       A Guzzle HTTP client.
  * @param mixed $wsdl                   URI of the WSDL file or NULL if working in non-WSDL mode.
  * @param array $options                Supported options: location, uri, style, use, soap_version, encoding,
  *                                      exceptions, classmap, typemap, and feature. HTTP related options should
  *                                      be configured against $client, e.g., authentication, proxy, user agent,
  *                                      and connection timeout etc.
  * @return SoapClientInterface
  */
 public function create(ClientInterface $client, $wsdl, array $options = [])
 {
     if (null === $wsdl) {
         $httpBindingPromise = new FulfilledPromise(new HttpBinding(new Interpreter($wsdl, $options), new RequestBuilder()));
     } else {
         $httpBindingPromise = $client->requestAsync('GET', $wsdl)->then(function (ResponseInterface $response) use($options) {
             $wsdl = $response->getBody()->__toString();
             $interpreter = new Interpreter('data://text/plain;base64,' . base64_encode($wsdl), $options);
             return new HttpBinding($interpreter, new RequestBuilder());
         });
     }
     return new SoapClient($client, $httpBindingPromise);
 }
开发者ID:meng-tian,项目名称:async-soap-guzzle,代码行数:24,代码来源:Factory.php


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