Working with the Twitter API 1.1 changes

Published by | Monday, July 15th, 2013

Twitter API v1.1

Did your Twitter app stop working after the 1.1 version of their API was released? Twitter made recent changes to its API that affected a lot of users and applications connected to the service, so I wrote a small PHP script that duplicates much of the old Twitter API functionality. The video below demonstrates the steps you’ll need to take to use it in your web apps.


An API is an Application Programming Interface, a way for developers to connect to and work with services. It’s one reason why both Twitter and Facebook were able to achieve such critical mass—an API allows users to incorporate functionality and build applications based on their own services.

In the old days, getting a stream of user tweets was as simple as calling a URL and asking JavaScript to translate the feed of information that the URL returned. However, Twitter—much like Facebook—now asks users to be authenticated in order to prevent massive misuse of their API.

The result? A lot of applications using the Twitter API recently stopped working. For example, one of the courses I wrote called jQuery Mobile Web Applications used the original Twitter API to pull feeds of information into a list of tweets by a certain user. The steps to get that application—or anything still using the old API—now involve a lot more work. The script I wrote will get you most of the way there, but you’ll need to do some additional legwork.

1. Download my PHP script.
2. Register with Twitter as a developer.
3. Create a new application and copy the consumer key, consumer secret, access token, and access token secret.
4. Paste the above into the appropriate spots in my PHP script.
5. Upload the script to a server that’s configured to serve PHP.
6. Download a copy of the tmhOAuth library.
7. Copy the tmhOAuth.php file into the same FTP folder as the tweets_json.php script.
8. Download an authorization certificate and copy it into the php folder.
9. Use the script in your project.

This PHP script has a lot of options: You can ask for a specific amount of tweets, a different account, or even a different path. Just keep in mind that according to the new Twitter API policy, you need to either own the timeline or be an approved follower of the owner.

Interested in more?

• Become a member today
• All courses by Ray Villalobos

Share this:Share on Facebook2Tweet about this on Twitter7Share on Google+0Pin on Pinterest0Share on LinkedIn0 - start learning today

Tags: , , , ,

Leave a Reply