简体   繁体   English

带委托的PHP中的异步HTTP请求

[英]Asynchronous HTTP request in PHP with delegate

how can I make an asynchronous HTTP request in PHP passing a delegate to the function? 如何在PHP中通过将委托传递给函数来进行异步HTTP请求?

Thanks 谢谢

PHP doesn't really support async callbacks since there are no interrupts in the language. PHP实际上并不支持异步回调,因为该语言没有中断。 Your best of using curl, and then checking back on the request to see if it has finished. 最好使用curl,然后再检查请求以查看是否完成。 You can also use fsockopen and friends to do it on a socket level. 您还可以在套接字级别使用fsockopen和朋友来执行此操作。

Check out this post. 看看这篇文章。 You'll need to tweak it to save the result socket (and process it), but the basic idea is there. 您需要对其进行调整以保存结果套接字(并对其进行处理),但是基本思想就在那里。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM