I have written some independent PHP modules for Drupal. Each of these modules interface with external APIs, using a GET request to get back either XML or JSON content. Lately, the API server has been hanging up on the requests. Because PHP by nature processes in sequential order, pages with multiple modules loaded ended up hanging for excessive amounts of time. What would be the best way to to:
1) Quickly detect a hanging connection, and move on
2) Move all the requests into an asynchronous mode, (using stream_socket_client?), so all the requests are happening at the same time, as opposed to sequentially.
Any ideas would be greatly appreciated.