本文整理匯總了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);
}