PDA

View Full Version : How to cache or throttle twitter API requests write to XML file?


typografuk
02-17-2011, 11:29 PM
Hi,

I recently put together a little AS3 app that displays recent tweets for a few websites. But in the twitter API it appears they limit API requests to 200 an hour per domain. So just wondering if others here have a recommended solution.

I was thinking I could write an AS3 app that pings twitter once every hour and then copy that xml feed and write to a local xml file. But then I thought how do you trigger this to happen?

My first guess would be that the twitter app hits up the local xml file, checks the timestamp, and if it's older than an hour, ping the twitter API over write the old xml file with the new data.

One problem I had in the past with writing data to XML files was that I've had XML files would wind up blank. I guessed this might be occurring when multiple events with multiple users at the same time happened and it basically freaked out? Don't know really but this worries me it might happen again.

Any suggestions or insight appreciated.

Cheers

banditd
03-23-2011, 08:48 AM
I'm currently dealing with the same problem. What I've figured out so far, is that you probably need a php file, which saves the data to a XML file every 10 minutes or so. But I haven't figured out a solution yet.

Something about php caching, which is all new to me.