Page 1 of 1

curl multy - infinity loop

Posted: Sun Oct 26, 2008 12:27 pm
by ddragas
can somebody please check why is it entering into infinity loop?
path is array of URL's

infiniti loop is on

Code: Select all

 
        do  {
            curl_multi_exec($mh,$running);
        } 
            while ($running > 0);
 
complete code

Code: Select all

 
        for($r = 0; $r<= count($path); $r++){
            $ch[] = $r; 
        }
 
        for($chInit = 0; $chInit<count($ch); $chInit++) {
            $ch[$chInit] = curl_init();
            curl_setopt($ch[$chInit], CURLOPT_URL, $path[$chInit]);
        }
        
        $mh = curl_multi_init();
        
        for($chMH = 0; $chMH<count($ch); $chMH++){
            curl_multi_add_handle($mh,$ch[$chMH]);      
        }
        
        $running=null;
        
        do  {
            curl_multi_exec($mh,$running);
        } 
            while ($running > 0);
        
        for($chMH1 = 0; $chMH1<count($ch); $chMH1++){
            curl_multi_remove_handle($mh,$ch[$chMH1]);
        }
        curl_multi_close($mh);  
 

Thank you all

kind regards

Re: curl multy - infinity loop

Posted: Sun Oct 26, 2008 3:49 pm
by Chalks
you never change the value of $running when you're inside your while loop.