![](/img/trans.png)
[英]GA Conversions link transaction to client id theiconic/php-ga-measurement-protocol
[英]Async requests in guzzlephp (or php-ga-measurement-protocol)
有谁知道如何使用guzzlephp发送有效且非阻塞的异步请求?
似乎对此有支持,但似乎没有实现
<?php
$this->guzzle->requestAsync('post', 'http://', ['synchronous' => false])->wait();
?>
从某种意义上说是在不等待响应的情况下实现的。
php-ga-measurement-protocol也有问题
$analytics->setAsyncRequest(true)->sendPageview();
您在说什么问题?
完全按照您的描述,异步请求在Guzzle中可以正常工作。 您只要立即从requestAsync()
获得了一个承诺,就可以做其他事情并获得响应。
// ['synchronous' => false] is not required.
$responsePromise = $this->guzzle->requestAsync('post', 'http://...');
// Your stuff...
$response = $responsePromise->wait();
不知道php-ga-measurement-protocol,BTW,但是似乎这个lib也正确实现了它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.