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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.