ID: 38620 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: cURL related Operating System: Debian Sarge PHP Version: 5.1.6 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2006-09-06 07:54:31] [EMAIL PROTECTED] <?php $u[] = 'www.yahoo.com'; $u[] = 'www.flickr.com'; $u[] = 'www.google.com'; $u[] = 'www.digg.com'; $u[] = 'www.shoutwire.com'; $u[] = 'www.example.com'; $u[] = 'www.cnn.com'; $u[] = 'www.ibm.com'; $u[] = 'www.winamp.com'; $u[] = 'www.linkup.com'; $u[] = 'www.nbc.com'; $u[] = 'www.amazon.com'; # uncomment this to test with a single host (should work with no timeouts in a snap) # $u = array_fill( 0, 20, 'www.google.com' ); $mh = curl_multi_init(); foreach( $u as $i => $d ) { $conn[$i] = curl_init( 'http://'.$d ); curl_setopt( $conn[$i], CURLOPT_RETURNTRANSFER, 1 ); curl_setopt( $conn[$i], CURLOPT_FOLLOWLOCATION, 1 );//follow redirects curl_setopt( $conn[$i], CURLOPT_MAXREDIRS, 1 );//maximum redirects curl_setopt( $conn[$i], CURLOPT_USERAGENT, 'Mediapartners-Google/2.1' ); curl_setopt( $conn[$i], CURLOPT_TIMEOUT, 20 ); curl_multi_add_handle( $mh, $conn[$i] ); } do { $mrc = curl_multi_exec( $mh, $active ); } while( $mrc == CURLM_CALL_MULTI_PERFORM ); while( $active and $mrc == CURLM_OK ) { if( curl_multi_select( $mh ) != -1 ) { do { $mrc = curl_multi_exec ($mh, $active ); } while( $mrc == CURLM_CALL_MULTI_PERFORM ); } } if( $mrc != CURLM_OK ) { print "Curl multi read error $mrc\n"; } foreach( $u as $i => $d ) { echo $i.' - '.$d."\n"; if( ( $err = curl_error( $conn[$i] ) ) == '' ) { echo 'found something'; } else { echo $err."\nnoconnect"; } echo "\n--\n"; curl_multi_remove_handle( $mh, $conn[$i] ); curl_close( $conn[$i] ); } curl_multi_close( $mh ); ?> ------------------------------------------------------------------------ [2006-09-03 09:20:56] [EMAIL PROTECTED] Complete reproduce code? The multi interface also works fine with pecl/http. ------------------------------------------------------------------------ [2006-09-02 22:45:37] [EMAIL PROTECTED] just btw. the multi interface of libcurl works fine with perl, c (and cpp). ------------------------------------------------------------------------ [2006-09-02 18:10:16] [EMAIL PROTECTED] see in the manual on the php.net/curl_multi_exec, there is the example code. trust me, i tested it very hard with everything i know. because i need this function... so the only workaround for me is to code a cpp appl, make a perl script or something else but you cant take php for this. and this sucks. because the function is there but you cant use it. i mean it should work. why is there a function that doesnt work... drives me nuts ;) ------------------------------------------------------------------------ [2006-09-02 17:42:37] [EMAIL PROTECTED] There's no example code on the manual page. Did you only set the transfer timeout or the connect timeout option too? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/38620 -- Edit this bug report at http://bugs.php.net/?id=38620&edit=1