2

how can I make an asynchronous HTTP request in PHP passing a delegate to the function?

Thanks

Mark
  • 67,098
  • 47
  • 117
  • 162
  • 1
    I don't think you can do that in php. The closest thing would be `curl_multi_init()` http://www.php.net/manual/en/function.curl-multi-init.php. – PiZzL3 Apr 27 '11 at 01:32

1 Answers1

1

PHP doesn't really support async callbacks since there are no interrupts in the language. Your best of using curl, and then checking back on the request to see if it has finished. You can also use fsockopen and friends to do it on a socket level.

Check out this post. You'll need to tweak it to save the result socket (and process it), but the basic idea is there.

Community
  • 1
  • 1
Kendall Hopkins
  • 43,213
  • 17
  • 66
  • 89