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; > } > > > -- > Scott * If you contact me off list replace talklists@ with scott@ * > > -- Internets. Serious business.
