cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: multiple simultaneous transfers

From: <theexperts_at_allprodirect.com>
Date: Mon, 18 Mar 2002 05:29:38 -0500

Okay, looking back at my question I can see that I did not state it clearly.
Sorry! 8>(

What I meant is: I am submitting a search to different sites to obtain
different results from each and display them on my site. Kind of like a meta
search engine. I need the remote hosts to race each other to see who can be
the first one to give my page some content! Not only will the content start
appearing on my page faster, but oodles of time will be saved over the
entire process.

Currently, my script must wait for the first site to finish responding
before moving on to the second, etc. Say, for example, site 1 takes a long
time to respond. You are staring at a blank screen until it finishes. Then
you have to wait for site 2, etc. Meanwhile, site 3 might have finished much
more quickly than either of them. So I would like to submit all the
requests, let them run concurrenlty on the remote servers, and then display
the results as they come in.

I know how I would do this without curl: I would send the request to each
host before looking at any of the responses. Then I would loop through all
of them looking for responses, reading a chunk of any response, and if the
end of file for any host is reached I would format and output the results
for that host. Continuing the loop until all hosts are done.

The question is how to do it with curl. I.e. can I tell curl to submit the
requests but don't wait for results, then cycle through the hosts to see if
any of them responded yet, and if so read the result in and process it?

Misc. background: Each site has different requirements, e.g. fieldnames,
authentication, etc., so the request is formatted as appropriate for each
site, and does not simply execute the same curl function on a different
host.

Do you grok my application now? ;>)

-J.
Received on 2002-03-18