Jump to content

Timeout when using curl_multi functions


Porl123

Recommended Posts

Hi all, I've got a relatively simple script where I'm trying to perform a multiple curl call to several pages as once. I'm running this in wamp and the cURL extension is definitely enabled and normal curl functions work fine. When I run the script below the page times out:

 

http://pastebin.com/vxMDmnbh

 

I suspect the timeout's being caused by this section here:

 



$active = null;
do {
$mrc = curl_multi_exec($mh, $active); echo 'g';
} while($mrc == CURLM_CALL_MULTI_PERFORM);

while(false && $active && $mrc == CURLM_OK) {
if(curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while($mrc == CURLM_CALL_MULTI_PERFORM);
}
}

 

But I can't be sure. This is effectively the sample code given on the php.net page and it's not loading. Can anyone spot the problem?

 

Thanks,

 

Paul

Link to comment
https://forums.phpfreaks.com/topic/272759-timeout-when-using-curl_multi-functions/
Share on other sites

while($active && $mrc == CURLM_OK) {
if(curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while($mrc == CURLM_CALL_MULTI_PERFORM);
}
}

 

After some more testing it seems the do..while loop is never reached as curl_multi_select($mh) always returns -1. Also the page times out because the condition in the outer while loop is always true "$active && $mrc == CURLM_OK, " although I'm really not sure why that is. :( Any thoughts?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.