Although it hasn’t helped me find a job, I’ve continued to build stuff with PHP. I’ve also been brushing up on my Objective-C. After upgrading to use Version 2 of the GData (YouTube) API I had to upgrade to Version 1.1 of the Twitter API. This took a lot more work especially trying to meet the display requirements. I’m not sure it is perfect, it is close and I’m still not a PHP guy. Once again I’ll decided to include the key code snippets in a blog post as no one uses them if I just check them into GitHub. Plus the code is probably more useful without all the overhead of every other API.
Searching Twitter and Displaying the Tweets with PHP & CSS
- Register an app with Twitter, you will need a pair of keys and two more keys that represent your access token.
- Download and create an instance of CodeBird in your code. Instructions are linked to above.
- Borrow two functions from the web: relativeTime() and linkify_tweet().
- You need to include widgets.js in your client code, Twitter provides this.
- I created two methods, one for searching and one for displaying the returned tweets correctly. I put them in Pastebin in addition to GitHub.
You also need a whole bunch of CSS rules to make it look pretty:
- Searching YouTube with PHP
- My PHP classes for making web mashups
- Feed Me!
- albumCollection.php is starting to come together