[twitter-dev] Re: http return 0

2009-10-16 Thread Scott Haneda


Correct, error 0 means no data was returned, and that the timeout in  
curl was hit, which I have set to 10 seconds.  I am seeing about 5 of  
these per Admin block 24 hours, out of around 300 calls per 24 hours.


I see a lot more of them when I see more of the 502 errors, which  
seems to tell me that when twitter is over capacity there is a  
tendency for them to completely close down the port for communication  
all together.


What is annoying about this, is that twitter.com is fine during all  
this, their public timeline works 100%, yet my API driven calls to the  
public timeline are getting error 0 and 502 many times per day.

--
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.




[twitter-dev] Re: http return 0

2009-10-15 Thread JDG
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 talkli...@newgeo.com 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;
 }


 --
 Scott * If you contact me off list replace talklists@ with scott@ *




-- 
Internets. Serious business.


[twitter-dev] Re: http return 0

2009-10-15 Thread Scott Haneda


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 talkli...@newgeo.com  
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;
   }