Twitterfeed.php - Get your authenticated Twitter stream as an Atom feed

[image]

A few days ago Twitter finally killed Atom support in their API. I just noticed for the first time last night, though I did know it was coming as they announced it months ago. Still, the change took me by surprise as I hadn't gotten around to updating the script I use in my custom news reader. A year or so ago I used Twitter's OAuth php library to grab my stream by pulling the Atom XML directly into my reader in a way that groups and formats it how I like. But with that format no longer available, I need to process the JSON result first and convert it to XML which I then pass on as a normal feed. Not hard, but there's always little issues - like the fact that I never saved a recent version of Twitter's Atom feed, so I wasn't sure what data it had until I found an old copy out on the web.

Anyways, I wired something up last night to get it working, but then today decided to make the script more self-contained so it didn't rely on any third party libraries. You can query OAuth resources using just command-line CURL requests, so how hard could it be, right? Surely I didn't need a whole library just for a single request! Well, that was about 4 or 5 hours ago and I just got the damn thing done. OAuth has so many moving parts, it's nearly impossible to get it formatted and authenticated correctly.

I put the script up as a Gist on Github here and embedded below. (It's licensed as something I like to call, "Don'tBugMeWare": Feel free to do what you want with it, but don't frigin' email me for support. Ever.)

In order to use it, follow the instructions here to add a Twitter App and authenticate it via their interface so you can get the tokens/secrets to use right away. Then just plug in the values into the right places in the script and then pop the file on a server somewhere where no one but you and your feed reader can see it and you're good to go.

Share and Enjoy!

-Russ

< Previous         Next >