skip to main content

Twitter

Multiple Users – Access Twitter 1.1 API with Oauth Script

Primarily the focus on this tutorial is to display your cached tweets for 2 users using PHP and OAuth on your website. We will be accessing the secure Twitter 1.1 API with PHP by parsing both json files and merging them into a single file to cache and store on your server. This is a follow up from Display Your Cached Tweets Using PHP and OAuth which is recommended for a single twitter user.

Display Your Cached Tweets Using PHP and OAuth

Primarily the focus on this tutorial is to display your cached tweets using PHP and OAuth on your website. We will be accessing the secure Twitter 1.1 API with PHP by parsing and caching the Json file to store on your server. It may seem a lot of code just to display your latest tweets on your website but the benefits are that you can style it to your own taste with a little CSS and caching the Json file will not add extra load on the Twitter API. For WordPress users you should use WordPress – Display your Cached Tweets using PHP and OAuth or my new plugin.

WordPress – Display your Cached Tweets using PHP and OAuth

Primarily the focus on this tutorial is to display your cached tweets using PHP and OAuth on your WordPress website. We will be accessing the secure Twitter 1.1 API with PHP by parsing and caching the Json file using the WordPress API. It may seem a lot of code just to display your latest tweets on your website but the benefits are that you can style it to the taste of your theme with a little CSS and caching the Json file will not add extra load on the Twitter API.

New Update. I have packaged all of the features and more into a WP plugin. Please remember to remove any of the code used from this post before installing the plugin. Check out WOW-Twitter.

Create a Twitter App For The New API

As you may, or may not know, Twitter are going to depreciate version 1 of their API next March. What does this mean to you? If you currently parse the Json file to display your tweets you will no longer be able to have access unless you use the authentication features. Why authentication? Various reasons I assume to limit users from making unnecessary calls to the API, Security reasons. How do I go about it? Well now you will have to create a Twitter App then use a form of authentication to make the API call.

Display Your Twitter Posts On Your Web Site!

Twitter

There are lots of resources out there for displaying your latest twitter posts in your website. Some of them require plugins or some may require javascript to work. After trying a few scripts I came across a little PHP script from The Lylo Files that displays up to 20 of your posts on your web site. After using it for a little while I decided to make it more functional.

This script has been depreciated in favor of the the new Twitter API. Check out Display your Cached Tweets Using PHP and OAuth