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

curl-and-php

feature request and/or just help me

From: *~^-+=:[*_*]:=+-^~* <alex_at_windeagle.org>
Date: Mon, 9 Aug 2004 06:38:53 -0400

i have an idea that will make curl_multi_* functions much better to use, for
example if u want to get a lot of urls but dont want to wait for it to dl
all of them but instead want to do something to it when one of the downloads
finishes, for example add a CURLOPT_DONEFUNCTION that would point to a
function that would run when one dl finishes, so another words u can start
to mess with the finished downloads as soon they finish without waiting for
all of them finish, sort of like using threads but better

anyways i am looking for feedback
btw my name is alex and u can ignore the way i write, i mean about the
run-on sentence, i just wanted you guys to get my idea.
also i am totally into php, so i would love to get this functionally in php
almost forgot, there would have to be sent in the args the curl handle and
also a extra variable that the user may set with a CURLOPT_DONEDATA ofcourse
that variable can be anything, like a an array or just a simple integer or
even a string

also there is a way to do this without adding this functionallity is by
telling me what function that i can use in php/curl to tell if a particular
curl_easy handle is actually finished

it would make my day

for example:

<?

        $URL = array(
                        "http://www.cnn.com/",
                        "http://www.yahoo.com/"
                        );

        $CURLM = curl_multi_init();

        foreach ($URL as $X => $url) {
                $CURL[$X] = curl_init($url);
                curl_setopt($CURL[$X],CURLOPT_RETURNTRANSFER,1);
                curl_multi_add_handle($CURLM,$CURL[$X]);
        }

        $PAGE = array();
        while(CURLM_CALL_MULTI_PERFORM == curl_multi_exec($CURLM,$active));
        while($active){
                foreach($URL as $X => $url){
                        if(/* this is the part that i need in order to find
out if the page has finished */){
                                $PAGE[$X] =
curl_multi_getcontent($CURL[$X]);
                                /* do something with the returned page */
                        }
                }
                while(CURLM_CALL_MULTI_PERFORM ==
curl_multi_exec($CURLM,$active));
        }

?>

also i would make this into a class as soon as i get this answer, so u
understand that this is just sample code

and i have a question, what happens to the curl_easy handle after its
finished, i mean can i reuse it, or even better can i add more handles to
curl_multi in between curl_multi_exec calls

anyways as u can see i have a lot of questions and a bit of good ideas and
even if u guys dont know i have to say that "curl rocks!!!!!!!!" and my http
functions didn't even come close to what curl does and it kind makes me mad
that i was too lazy to check u guys out b4 cuz i would have saved myself a
lot of time by using curl from the beginning, although my http functions are
very well done, its just that it was a waste of making them from my point of
view

anyways i know i talked way too much but please bear with me, and incase i
forgot something or something like that let me know
Received on 2004-08-09