New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Learn it fast with expert-taught software and skills training at lynda.com. See what you can learn

By Ray Villalobos | Monday, July 15, 2013

Working With The Twitter API 1.1 Changes

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 lynda.com member today • All courses by Ray Villalobos

Learn it from the experts.

With online video courses at lynda.com, you can reach your goals faster. Learn software, improve your skills, and get an inside look at how the professionals work.

See what you can learn


Share this article:

Tags: , , , ,

Get the latest news

  •   New course releases
  •   Pro tips and tricks
  •   News and updates
  
New releases submit clicked

You can change your email preferences at any time. We will never sell your email. More info

All articles

Featured articles

A lynda.com membership includes:

Unlimited access to thousands of courses in our library
Certificates of completion
New courses added every week (almost every day!)
Course history to track your progress
Downloadable practice files
Playlists and bookmarks to organize your learning
Become a member

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.