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

curl-and-php

Using CURLOPT_TIMEOUT_MS correctly?

From: Kevin Eppinger <ke7227_at_sbcglobal.net>
Date: Wed, 30 Jan 2008 07:47:03 -0800 (PST)

The behavior I'm experiencing from using this option 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 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

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2008-01-30