I think so too, I am running some more tests. I have confirmed with a
parallel test to a "nearby" host to twitter, that I am able, at the
same time, to make a http request to their resource. While I can not
time the curl actions to happen at the exact same time, one much
happen before the other, the difference in time is:
2009-10-15 15:01:05.5321030
2009-10-15 15:01:05.5327020
So something like 5990 microseconds. I have set the order to be
random, so one will happen first some of the time, and the other first
some of the time, if random() is relatively even, and it was my
connection, I should see errors on the other resource a few times,
which I am not.
If curl_error shows me anything else, I will let the list know.
--
Scott * If you contact me off list replace talklists@ with scott@ *
On Oct 15, 2009, at 1:45 PM, JDG wrote:
i think http 0 in curl just means the connection failed. should
probably
just retry.
On Thu, Oct 15, 2009 at 14:44, Scott Haneda <[email protected]>
wrote:
I have a pretty simple function I made to curl a url against
twitter. I am
whitelisted. I call a url once every 15 seconds, about once an
hour, I get
'http_response' of 0, the rest I get 200 OK.
When I do not see a 200, I log the 'http_response', is there
anything else
I can log or enable in the curl code below to figure out what is
going on
here? I am going to add curl_error to the result, and see what I
get from
that, but thought I would as for any pointers.
function curl_url($url) {
$ch = curl_init(); // create a new curl resource
curl_setopt($ch, CURLOPT_URL, $url); // set URL to download
curl_setopt($ch, CURLOPT_REFERER, 'http://example.com/'<http://example.com/%27
>);
// set referer:
curl_setopt($ch, CURLOPT_USERAGENT, 'example'); // user
agent:
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // return,
not
print
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // timeout in seconds
// download the given URL, and return output
$output = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch); // close the curl resource, and free system
resources
$return_data['http_response'] = $http_code;
$return_data['page'] = $output;
return $return_data;
}