By the time you read this article, you must know that Twitter has retired its API v1 and now ensure that all new requests are served using v1.1 of the API. As I mentioned in my previous article, we now need to authenticate users before trying to retrieve the user's timeline. For this, we need to perform 2 steps. They are:

This article describes how to connect your Twitter app to get the user's Tweets via PHP.

We will be using the twitteroauth library written for PHP to implement this. You can get the library from github here. One of the biggest advantages of implementing this using a server side language (C#, PHP) is that you do not expose the secret keys of your app to the end users. The app is called from the server end using secure parameters and then only the data in JSON format is returned back to the end user that you can opt to show in your own specific design.

Prerequisites for running the code:

Let's write some code now

You will see the number of Tweets requested by the file on your browser. The following is a sample output.

Understanding the code

I hope you like this article and in case you encounter any issues implementing the oAuth library, contact me via comments or via social media.