|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-12-31 10:42 UTC] sterling@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 11:00:02 2025 UTC |
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'