I was wondering what the best way to do concurrent HTTP requests in PHP? I have a lot of data to get and i'd rather do multiple requests at once to retrieve it all.
Does anybody know how I can do this? Preferably in an anonymous/callback function mannor...
Thanks,
Tom.
解决方案
You can use curl_multi, which internally fires off multiple separate requests under a single curl handle.
But otherwise PHP itself not in any way/shape/form "multithreaded" and will not allow things to run in parallel, except via gross hacks (multiple parallel scripts, one script firing up multiple background tasks via exec(), etc...).