php weird cURL behavior

Help
Richard
2012-03-24
2012-09-25
  • Richard
    Richard
    2012-03-24

    I can fire off a curl_exec() and get results, but I can't get results from
    curl multi.

    I'm using zwamp 2.1 for 64 bit, Win 7 Ultimate.

    I have the curl extension enabled (obviously if curl_exec() works).

    Something like this doesn't work (There are initialized and optionized curl
    handles in $this->sessions):

    $mh = curl_multi_init();
    
            #Add all sessions to multi handle
            foreach ($this->sessions as $session) {
                curl_multi_add_handle($mh, $session);
            }
            $running = null;
    
            do
                $mrc = curl_multi_exec($mh, $active); while ($mrc === CURLM_CALL_MULTI_PERFORM);
    
            $sleep = 10;
            while ($active && $mrc === CURLM_OK) {
                usleep($sleep);
                if (($temp = curl_multi_select($mh)) !== -1) {
                    do
                        $mrc = curl_multi_exec($mh, $active); while ($mrc === CURLM_CALL_MULTI_PERFORM);
                }
                $info = curl_multi_info_read($mh);
                $sleep *= 1.1;
            }
    

    The curl_multi_select function returns -1 for some reason and so does
    curl_multi_info read. I've even added the curl handles to the curl_multi_init.