Updating or Repairing your Twitter feed for API v1.1

Updated Version Here!

As predicted by the Mayans, Nostradamus and Russell Grant as of 11th June 2013 the twitter 1.0 API has been deprecated. If you have landed on this blog from a Google search of “Repairing my Twitter feed with API v1.1″ or something similar,  you will probably already know this if you haven’t realised, and have used our previous tutorial to add a twitter feed to your site in the past. please watch the below tutorial to learn how to fix it and get a twitter feed for API v1.1.

I hope the screencast was of help to you, I just thought I’d sum up some of the main points below.

Like i mention in the screencast this whole process is based on

http://www.webdevdoor.com/javascript-ajax/custom-twitter-feed-integration-jquery/

and

https://github.com/abraham/twitteroauth

however i had to make some changes to the odd file to get it to work for me, so i have packaged up the full working solution here

Download

 

These are the main steps outlined in the screen cast.

 

Step 1

This process is easypeasey  and you should have a set of keys

twitter-feed-authentication.

  1. Visit https://dev.twitter.com/apps/ and sign in using your Twitter username and password. This doesn’t have to be the username or password of the stream you need access to, just a Twitter account you control.
  2. Select ‘Create new application’ and enter the application details.
    1. The name and description can be anything you like really, but you can’t use ‘Twitter’ in the name.
    2. The website field can be your main website and doesn’t have to be the site where your Twitter feed or feeds are located.
    3. Callback URL can be left blank
  3. Enter the CAPTCHA info and click create
  4. On the next details screen, click ‘create my access token’. You may need to refresh the page after a few seconds if it doesn’t appear automatically.
  5. Make a note of the Consumer key, Consumer secret, Access token and Access token secret as highlighted below.

 

Step 2

1. Save your get-tweets.php in the root of your site and make the server permissions executable as below

 

Twitter feed for API v1.1

 

2. Fill in the details to match your twitter app

session_start();
require_once(“twitteroauth/twitteroauth/twitteroauth.php”); //Path to twitteroauth library$twitteruser = “twitterusername”;
$notweets = 3;
$consumerkey = “#####################”;
$consumersecret = “#####################”;
$accesstoken = “#####################”;
$accesstokensecret = “#####################”;

 

Step 3

Add the Java Script to your site you will find this file in your twitteroauth-master download package but it is worth moving it to where you store your javascript files maybe in a /js folder, in the screen cast i put it in the root of the site if you do this you will just need to make sure that you change your url reference in your HTML


 

Add the HTML:

<div id=”twitter-feed”></div>

And thats about it, hopefully the screen cast covers the rest, get in touch if you need any further help!

Written by Adam Jackson