Want To Be A Blogger  →  Start A Blog  →  Increase Traffic  →  Make Money Online  →  Recommended Things

Display Latest Twitter Status Using PHP

Friday, Jan 5, 2018

Tags:- PHP

In this tutorial we will show you how to display your latest twitter status using PHP.There are many websites which uses this feature in their website to keep updated their user from latest status of website on twitter.You may also like Login With Twitter Using PHP.

Display Latest Twitter Status Using PHP

To Display Latest Twitter Status It Takes Only Two Steps:-

  1. Create a Twitter app and get all the details
  2. Make a PHP file to display twitter status

Step 1.Create a Twitter app and get all the details

You have to create an application on twitter from here https://apps.twitter.com/. Then you need to collect API keys, API secrets and your access token, access token secret.You also need to download Twitter Outh PHP Library to get your latest status from twitter.

Step 2.Make a PHP file to display twitter status

We make a PHP file and save it with a name status.php

<div id="wrapper">


$twitter_customer_key = 'Your API Key';
$twitter_customer_secret = 'Your API Secret';
$twitter_access_token = 'Your Access Token Key';
$twitter_access_token_secret = 'Your Access Token Secret';

$connection = new TwitterOAuth($twitter_customer_key, $twitter_customer_secret, $twitter_access_token, $twitter_access_token_secret);

$my_tweets = $connection->get('statuses/user_timeline', array('screen_name' => 'Your Name', 'count' => 1));

echo '<div class="twitter-bubble">';

 echo 'Error :'. $my_tweets->errors[0]->code. ' - '. $my_tweets->errors[0]->message;
 echo $my_tweets[0]->text;
echo '</div>';


In this step we insert twitter outh library which is required to get your latest status and then we add all our details like keys and secrets then we create a object of TwitterOAuth by passing all the details in it and then we get and display our latest status or tweets from twitter.

Thats all, this is how to display latest twitter status using PHP.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

Subscribe Our Newsletter And Get Tutorials And Offers Via Email

About Me

Hello, My Name is Mudit Jain. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of TalkersCode. I started this blog in february 2015 to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers.