Pull your latest tweet with PHP

by Bradley on July 5, 2011

Found some better code to pull your latest tweet:

<?php
	$username='thatbradleyguy'; // set user name
	$format='json'; // set format
	$tweet=json_decode(file_get_contents("http://api.twitter.com/1/statuses/user_timeline/{$username}.{$format}")); // get tweets and decode them into a variable
	echo $tweet[0]->text; // show latest tweet
?>

Want More out of WordPress?

I can show you how to get more traffic, make WordPress do amazing things, and how to make more money with your website by converting your visitors into customers. Click the button to the right to get a free estimate.

  • Pingback: Curl your latest Tweet using PHP

  • http://www.sigididesign.com Vezu

    Nice one. Thanks. How to i include the RT?

    • Bradley

      This code will show you retweeting others if the retweet is a quote retweet.

Previous post:

Next post: