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.

Previous post:

Next post: