curl-and-php
Re: unresponsive dns server and curl multi timeouts not working
Date: Thu, 05 Jun 2008 08:13:54 -0500
>> do {
>> curl_multi_exec($mh,$running);
>> while ( FALSE !==($msg = curl_multi_info_read($mh)) ) {
>> // print "ding ". $msg['handle'] ."\n";
>> }
>> } while ($running > 0);
>
> ... wasn't your code still spinning like crazy in this loop during those 74
> seconds? I mean, why don't you abort it after whatever time you see fit?
>
> Note also that this loop busyloops, which is considered very bad programming.
>
> But no, I'm not sure what this isn't timed-out the way you want, but I don't
> consider the timeout options terrible important in the multi interface since
> you can easily just stop the operation yourself at any time.
>
If you want some sample code on how to do curl multi requests
without busy-waiting, please check out my article at:
PHP curl_multi example of parallel GET requests
http://www.somacon.com/p537.php
The PHP documentation only has the bad programming examples online, for
brevity I'm guessing. Unfortunately, a lot of people are going to
implement it that way...
Any comments/feedback on the article are welcome.
Regards,
Shailesh
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-06-05