cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

curl_multi problems

From: <ben_at_periton.co.uk>
Date: Fri, 26 Oct 2007 05:32:22 -0400

Hi there,

Ive been having a bit of trouble with curl_multi and php. I've managed to
get it working and returning info etc, but the problem occours when more
than 1 person try to use the script.

The script goes to 5 different url's, grabs the data, parses it then
returns to the screen.

So, if I was using the script and someone else came onto my site and
clicked to start the search, their search wont start untill mine has
completed. Its as if curl_multi is locking itself and the script untill it
has finished.

Essentially, I want to be able to do multiple curl_multi's!

Here is my code:

do {
            $cmr = curl_multi_exec(self::$mh, $active);
        } while ($cmr == CURLM_CALL_MULTI_PERFORM);
       
       
        // While the conections are active
        while ( $active && $cmr == CURLM_OK ) {
       
            // Wait for network, ie not code of -1 (call
CURLM_CALL_MULTI_PERFORM again)
            if ( curl_multi_select(self::$mh) != -1 ) {
                // Get new data or timeout
                do {
                    $cmr = curl_multi_exec( self::$mh, $active );

                } while ( $cmr == CURLM_CALL_MULTI_PERFORM );
               
                // Get the info about the current transfer
                $cmi = curl_multi_info_read(self::$mh);
               
                // Supposedly the transfer has finished so we can start
parsing it :s
                if ( sizeof($cmi) > 1 ) {
                   
                    //print 'done - ' . (microtime(true) - $start) . '<Br
/>';
                    //ob_flush();flush();
                }
               
            }
           
        }

Thanks in advance!

--------------------------------------------------------------------
mail2web.com – Enhanced email for the mobile individual based on Microsoft®
Exchange - http://link.mail2web.com/Personal/EnhancedEmail

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-10-26