Sometimes job interviews for a developer position can be daunting. Images of a blank whiteboards and blank stares may come to mind. It’s always nice when you can choose a mini-project over a whiteboard interrogation. Just a few weeks ago I was challenged to complete two mini “aptitude tests” as a preliminary qualification for an in-person interview.
Here is one of the challenges that I was given:
Twitter is known to have a very user-friendly API and the documentation’s design reflects its friendliness. There are many tools that can help you integrate. One of them is TwitterOAuth, made especially for PHP.
I installed TwitterOAuth, followed the documentation to connect to Twitter’s API, used $twitter->get to pull down some tweets, and wrote a short loop to display them.
Here is the php I used to get the 10 latest tweets from my twitter account, “@wordofyourday”:
To finish, I included this php file in a basic web page that displayed the tweets, detailed my method, and listed the problems I ran into. You can see that page here. (I converted it to static html to avoid exposing my authentication keys.)