Javascript programming for Twitter changes dramatically with Twitter API version 1.1. The requirement to use OAuth with every API request means that you can no longer call the API directly from Javascript. Instead you have to rebuild all your Javascript code to proxy your requests through your own server. I know that a lot of [...]
Twitter API Tutorials
Twitter programming made easy
The Twitter API is great. The official docs aren’t. Learn how to build custom Twitter apps with PHP and MySQL with clear explanations and free code.
My Twitter OAuth ebook has been out for 2 weeks now, and I’ve had a chance to help a lot of people get over the hump of running their first OAuth code. I’ve collected a list of the most common problems they have: No callback URL When you create an app, Twitter has an input [...]
My Twitter OAuth ebook closes with the source code for an API Console application. This app got such a favorable response that I decided to enhance it and put it out as a free tool. I have found this to be an invaluable debugging aid when testing an API request. It lets you enter just [...]
It’s time to start converting your code to the Twitter API version 1.1. I’ve been using it for a while now, and it seems solid. Twitter is still saying that version 1.0 will be turned off on March 5th, so we all have to begin the upgrade process. (Update: The turn-off date for API 1.0 [...]
I’ve been using the same database schema for recording Twitter user information for a couple of years. I recently agreed to do a training session on Twitter follow programming for the Boston PHP Meetup group, so I decided to check out the Twitter API docs to see if they have gotten any better. I found [...]
There are two problems you typically want to solve with language detection for tweets. First you need to analyse the types of languages you end up with for a specific set of keywords, and determine the minimum confidence level needed to get a clean result. Then when you have that data, you can process a [...]
In yesterday’s installment we learned how to get the most likely language for a tweet with the detectSimple() function. We also discovered that this library sometimes fails when you get down to just 2 or 3 words. The Text_LanguageDetect library has a more advanced function, called detect(), that delivers an array of possible language matches [...]
The docs for the Text_LanguageDetect library say that you need to pass it 4-5 sentences to get an accurate language identification, but as we saw in part 1 of this tutorial, even a single sentence seems to work. This is great, since we will need this to work with tweets that average 5-6 words. So [...]
One thing I learned early on in building tweet aggregation sites for clients is that they expect to only see tweets in English. After all, Google can do it, why can’t I? In theory there is a lang=en argument in the search API, but it doesn’t help much, because it only uses the language setting [...]
Delivering the new RSS feed We are finally ready to put the new Twitter RSS feed together based on the tweets we’ve collected in the database. Let’s review what Twitter normally delivers, and then we can try to improve it. The standard feed for @BarackObama is delivered with this URL: https://api.twitter.com/1/statuses/user_timeline.atom?screen_name=barackobama And here is what [...]
Collecting all new and old tweets for any user In the last installment of this tutorial you learned how to collect the most recent 100 tweets from a user’s timeline. We are almost ready to start delivering the RSS feed, but first I want to show you how to gather new tweets for the user [...]
Inserting a user timeline into the database Now that we have the database table ready, we have to loop through all the tweets returned by the statuses/user_timeline Twitter API call, and insert them. The database programming will be done with my db_lib.php library. This is a simple PHP class that I use for all of [...]







