| |
|
|
|
cURL Mailing List Monthly Index Single Mail
curl-and-php mailing list Archives
Re: PHP Timeout Error in multi_curl
From: Suleman Butt <suleman.butt_at_gmail.com>
Date: Tue, 9 Oct 2007 17:22:41 +0200
In another example code:
[code]<?php
// set URL and other appropriate options
//create the multiple cURL handle
//add the two handles
$running=null;
curl_multi_exec($mh,$running);
} while ($running > 0);
?>
the script just hangs when i run it with specification:
PHP Version 5.2.4
The strange thing is when i remove the timeouts [code]curl_setopt($ch1,
The mentioned 2 feeds are very small which obviously require time in
But when i change the same code and include for example *www.cnn.com* as one
Another strange thing is that when i run all these above scenarios with
no problem comes.
-- Now in the end, could anybody tell me if the problem i have mentioned above is related to specification: PHP Version 5.2.4 curl-7.17.0 and if yes then with PHP or CURL? In my opinion it has something to do with the timeout but then in libcurl or php wrapper? thanks. On 10/4/07, Suleman Butt <suleman.butt_at_gmail.com> wrote: > > I'm executing this code from: http://de2.php > .net/manual/de/function.curl-multi-exec.php > > <?php > $connomains = array( > " http://www.cnn.com/", > "http://www.canada.com/", > "http://www.yahoo.com/" > ); > > $mh = curl_multi_init(); > > foreach ($connomains as $i => $url) { > $conn[ $i] = curl_init($url); > curl_setopt($conn[$i], CURLOPT_TIMEOUT, 15); //added myself > curl_setopt($conn[$i], CURLOPT_RETURNTRANSFER, TRUE); > curl_multi_add_handle ($mh,$conn[$i ]); > } > > // start performing the request > do { > $mrc = curl_multi_exec($mh, $active ); > } while ($mrc == CURLM_CALL_MULTI_PERFORM); > > while ( $active and $mrc == CURLM_OK) { > // wait for network > if (curl_multi_select( $mh) != -1) { > // pull in any new data, or at least handle timeouts > do { > $mrc = curl_multi_exec ($mh, $active); > } while ($mrc == CURLM_CALL_MULTI_PERFORM); > } > } > > if ($mrc != CURLM_OK) { > print "Curl multi read error $mrc\n"; > } > > // retrieve data > foreach ($connomains as $i => $url) { > if (($err = curl_error($conn[$i ])) == '') { > $res[$i ]=curl_multi_getcontent($conn[ $i]); > } else { > print "Curl error on handle $i: $err\n"; > } > curl_multi_remove_handle($mh,$conn[ $i]); > curl_close($conn [$i]); > } > curl_multi_close($mh ); > > print_r($res); > ?> > > > but getting this error: Curl error on handle 0: Connection time-out after > 15996 ms Curl error on handle 1: Connection time-out after 15996 ms Curl > error on handle 2: Connection time-out after 15996 ms. > > my php version: PHP Version 5.2.4 > my curl version: curl-7.17.0 > > Could anybody tell me why is this error coming? > > Surprisingly the above code works fine on PHP Version 5.1.4, and > curl-7-15-3 [image: Sad] > > thanks in advance.
_______________________________________________
These mail archives are generated by hypermail. |
Page updated November 12, 2010.
web site info