本文整理汇总了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');
}
}
示例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);
}