Tagged: Twitter

HangmanI did something weird with the Twitter API. A while back I used tweets to form the word puzzles for a Hangman game. You can feed the puzzles from a user’s stream by putting the user’s twitter handle in the URL, like ?twitter=mvs202. Oddly enough, this cool game never went viral, and it sat unloved and unplayed for a long time. When I tried it myself recently, it had stopped working. Here’s what happened and how I fixed it.

The original Twitter did not require authentication for the most basic searches. The API handled API calls just like it handled web searches, so the API version of twitter.com/search?q=test was simply search.twitter.com/search.atom?q=test. This worked great back when I wrote Game-ifying Twitter with Hangman two years ago. The new API requires developers to sign up. Plus, the response format has been totally changed to improve object consistency.

I wrote the game before discovering the joys of AJAX. Back then I consumed synchronous APIs by making the whole program in PHP. That means that the web page doesn’t render until the API call is complete so the server can wrap up the HTML code. Not a problem with Twitter, which has a speedy API, but still. The bigger problem is the readability of my own code. Mingling HTML and PHP makes for a difficult read, made worse by having “echo” statements generating HTML and Javascript on the fly. » Continue Reading…

Updating the API Approach