#27618 [Com]: curl_multi_info_read does not appear to work

From: Date: Sat, 19 Nov 2005 22:42:33 +0000
Subject: #27618 [Com]: curl_multi_info_read does not appear to work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-88565@lists.php.net to get a copy of this message
 ID:               27618
 Comment by:       adamsch1 at yahoo dot com
 Reported By:      jason at neodisco dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Any
 PHP Version:      5.0.0b4 (beta4)
 New Comment:

Seeing this on php 5.05 on windows.  Basically from the code (5.05) it
looks like curl_multi_info_read *should* return an array so one can
determine the state of the requests.  However this function doesn't
return anything.  

I've included my test wrapper which does work outside the call to
info_read.

Not supporing this function really cripples the usefulness of more
sophisticated programs that use curl_multi.

<?php

#-- Array of stuff
$connomains = array(
   "http://www.cnn.com/",
   "http://www.canada.com/",
   "http://www.yahoo.com/",
   "http://www.google.com/",
   "http://www.popmonkey.com/"
   );

#-- Initalize our multiple request
$mh = curl_multi_init();

#-- Setup each handle
foreach ($connomains as $i => $url) {
       $conn[$i]=curl_init($url);
       curl_setopt($conn[$i],CURLOPT_RETURNTRANSFER,1);
       curl_multi_add_handle ($mh,$conn[$i]);
}

#-- Perform the request
$lastactive = 5;
do {
  $n=curl_multi_exec($mh,$active);
  if( $active != $lastactive )  {
    $lastactive = $active;
    print_r( curl_multi_info_read( $mh ) );
    print "Left: $active \n";
  }
} while ($active);

foreach ($connomains as $i => $url) {
       $res[$i]=curl_multi_getcontent($conn[$i]);
       curl_close($conn[$i]);
}

#print_r($res);

?>


Previous Comments:
------------------------------------------------------------------------

[2004-03-17 00:02:22] jason at neodisco dot com

Description:
------------
Hello! 

I am writing a php-cgi server, using curl-multi.  It needs to start a
bunch of curl  'threads', and steadily process the results of finished
'threads' and start new ones in  their place.   

It seems to be working other than curl_multi_info_read() - this
function does not  return any data so I cannot see which curl threads
have finished and are ready for  processing.   

Looking at the curl.haxx.se curl-lib docs, it doesn't look too
complicated (I'm not a C  programmer though!) to implement, seeing as
everything else is working.  Perhaps I  have missed something entirely.
  

I assume it is the same problem as mentioned here:? 

http://marc.theaimsgroup.com/?l=php-dev&m=104791992407964&w=2


Thank you in advance for any help or suggestions you can offer, or
perhaps even an  ETA on when this function might be finished so I can
either wait, or skin the cat  another way. 

Warm regards, 

Jason 


Reproduce code:
---------------
$status_of_ch_threads = curl_multi_info_read();

Expected result:
----------------
Have the status returned



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27618&edit=1


Thread (4 messages)

« previous php.bugs (#88565) next »