Search code examples
phpapitwitter

How can my web app retrieve Twitter user photos without hitting the API limit?


I am writing a web app that needs Twitter user's profile photos only. I retrieve these by parsing the users/show XML unauthenticated API call (http://apiwiki.twitter.com/Twitter-REST-API-Method:-users%C2%A0show):

$twitterXML = simplexml_load_file("http://twitter.com/users/show/".$twitterUsername.".xml");

In my testing I have been hitting the Twitter API rate limit. When I retrieve the user photo URL in the above way is the Twitter API rate limit imposed on the IP address of my server so that anyone who uses my web app contributes to the 150/hour limit? Or is that limit imposed on the IP address of the user who is visiting my web page?

Is there any way to retrieve a user's profile photo without being affected by the rate limit?


Solution

  • It's your server that fetches the XML file, so it's the server IP address that is getting throttled. One solution would be to use some form of caching so you reduce the number of requests that your server is sending.