Using CURLOPT_TIMEOUT_MS correctly?

This is a discussion on Using CURLOPT_TIMEOUT_MS correctly? within the PHP General forums, part of the PHP Programming Forums category; T'he behavior I'm experiencing from using this option (CURLOPT_CONNECTTIMEOUT_MS, also) is strange. Here is a code snippet: ---------------------- $c = ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-28-2008
Kevin Eppinger
 
Posts: n/a
Default Using CURLOPT_TIMEOUT_MS correctly?

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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:56 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0