0

I making a php server/page which is supposed to capture a users twitter feed and then provide it in a JSON format to another application and/or mobile device in JSON format.

Twitter provides it's data already in JSON format by using .json after the timeline url. But this is limited to 150 requests/hour which can be a problem being on a shared hosted server.

If been trying to use the twitteroauth php library with API keys. Before I can start communicating with the API I always need to sign in with a twitter account. Using the API is limited to 350 request/hour.

Is there a way to use the library not needing to log in to capture the timeline? Or what is a better way to achieve my goal, creating a php-page providing me the timeline on request?

Johan_
  • 440
  • 5
  • 14

1 Answers1

1

If I understand the question correct, the problem is that you make to many request to the Twitter API that doesn't require log on. In that case, if you don't want to use the API that require login, I guess you could implement some caching. Let your server run a cron every minute that check the Twitter API for new tweets, and store the tweets in a database or a textfile.

Then, when a user request your page for JSON, you read from your cache instead of going straight to the Twitter API every time. That way you will save a lot of traffic between your server and Twitter, and you would still be very close to real time when it comes to up-to-date tweets, as you with 150 requests/hour could update your cache every 30 seconds or so.

Christofer Eliasson
  • 32,939
  • 7
  • 74
  • 103
  • Yes you have understand it exactly. I was also thinking caching might be the solution. I posted it to get some opinions and some other idea's. Thanks. – Johan_ Feb 12 '12 at 12:33