I started a little project: http://FriendOrFollow.com. It's a small
project, that's really started getting a lot of traffic.

The issue I'm having is, it works great with < 1 user request per
minute (avg 5 Twitter API requests per user). However, when I get a
large spike in traffic, I start getting "HTTP/1.1 400 Bad Request"
errors when I try to pull XML API data.

PHP Warning: file(http://twitter.com/statuses/friends/bob.xml?page=2)
[<a href='function.file'>function.file</a>]: failed to open stream:
HTTP request failed! HTTP/1.1 400 Bad Request\r, referer: 
http://FriendOrFollow.com/

I'm wondering if this is an issue of my server running out of
allocated PHP memory, perhaps a limit in PHP to the amount of requests
I can make at once, or if the Twitter API is just saying "enough" if I
make that many requests at once.

It could be my code, but it works fine at < 1 user per minute. It's
not a CPU limit. I'm on Media Temple and my GPU usage is modest.

I cache each user's results for 12 hours. These are new unique users
trying to get through at the same time.

Here's the code I use to retrieve the data:
$url = "http://twitter.com/statuses/friends/"; . $userName . ".xml?
page=" . $page;
$xml = implode("", file($url));

Does anyone have any hints / recommendations on what I should look
into?

Thanks!
Dusty

Reply via email to