Using CURLOPT_TIMEOUT_MS correctly?
| From: | Kevin Eppinger | Date: | Mon, 28 Jan 2008 17:14:36 +0000 |
| Subject: | Using CURLOPT_TIMEOUT_MS correctly? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-268209@lists.php.net to get a copy of this message | ||
T'he behavior I'm experiencing from
using this option (CURLOPT_CONNECTTIMEOUT_MS, also) is strange. Here is a code snippet:
----------------------
$c = curl_init("www.google.com");
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($c, CURLOPT_TIMEOUT_MS, 500);
$resp = curl_exec($c);
----------------------
This ALWAYS returns an errno 28 (Timeout was reached) for ANY URL that I try. The only way I can
get it to work is if I set the MS timeout value >= 1000. I can set it to 999 and it immediately
fails, but bump it up to 1000 and everything is fine. Is anyone else seeing this behavior?
----------------------
My PHP-
PHP 5.2.5 (cli) (built: Jan 24 2008 17:17:05)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
My cURL-
curl 7.17.1 (i686-pc-linux-gnu) libcurl/7.17.1 OpenSSL/0.9.7e zlib/1.2.2
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: IPv6 Largefile NTLM SSL libz
----------------------
Thanks for any help you can provide.
-Kevin