Has the 400 bug in the twitter api been fixed yet?
Bulletproof Twitter followers count with PHP?
I am reviving this question because it is happening to me that, without any change in code, sometimes my program works, sometimes it doesn't.
failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request
This error message comes from the line
$user = simplexml_load_string(file_get_contents('http://api.twitter.com/1/users/show/'.$twitter.'.xml'));
AND
$user = json_decode(file_get_contents('http://api.twitter.com/1/users/show/'.$twitter.'.json'));
Why does this sometimes work and sometimes not? I know it's not the maximum requests per hour because I come into work and see it right away when no one else uses my API开发者_运维问答 key. Please can someone tell me what keeps going wrong or if it's all Twitter's fault?
HTTP 400 responses are returned during rate limiting. Since you are not authenticating it is plausible that you are using your 150 request/hour per IP.
You can make authenticated requests to increase your limit to 350 requests/hour using TwitterOAuth or a number of other PHP libraries.
精彩评论