ID: 14371
Updated by: sterling
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: cURL related
Operating System: Linux 2.2.12-20
PHP Version: 4.0.6
New Comment:

Fixed in cvs and 4.1.*

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

[2001-12-06 22:24:27] [EMAIL PROTECTED]

Using --with-curl and "libcurl 7.8 (SSL 0.9.5)":

If you use the following function with a url that pings, but does not answer, it will 
die.  I have a script set up to continue for timeouts, but it does not continue, it 
dies.  If you change CURLOPT_RETURNTRANSFER to 0, it will not die, but also does not 
return the data in a variable as I need it to.

I would give you a url to try, but chances are that it will be back up by the time you 
get to this.  This works *fine* for sites not found, pages not found, dns errors, 
timeouts, etc.  It is only a problem if the computer is in the DNS records but does 
not respond (to ping).

function get_data($url, $timeout=15) {

        $timeout = (int)$timeout;
        $ch = curl_init ();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt ($ch, CURLOPT_MUTE, 0);
        curl_setopt ($ch, CURLOPT_TIMEOUT, $timeout);
        curl_setopt ($ch, CURLOPT_NOBODY, 0);
        curl_setopt ($ch, CURLOPT_HEADER, 0);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

        $page = curl_exec ($ch);
        #print curl_error($ch);
        #print "<br>";
        #print "page: $page";
        #$i = curl_getinfo($ch);
        #print_r($i);
        curl_close ($ch);

        return trim($page);
}

 './configure' '--with-apxs=/usr/sbin/apxs' '--prefix=/usr' 
'-with-config-file-path=/etc/httpd' '-enable-safe-mode' '--with-exec-dir=/usr/bin' 
'--with-system-regex' '--disable-debug' '--with-zlib' '-enable-debugger' 
'--enable-track-vars' '--enable-ftp' '--enable-wddx' '--with-gdbm' '--with-mysql=/usr' 
'--with-pgsql' '--with-xml' '--with-curl=/usr/local'



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



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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to