How to Retrieve the Latest Tweets In PHP

      No Comments on How to Retrieve the Latest Tweets In PHP

This post contains a little php snippet to search and retrieve the latest tweets from twitter. The documentation for twitter search function is available here and here:

$q = $_GET["q"]; // query string
$request = "http://search.twitter.com/search.json?q=".urlencode($q);
$response = file_get_contents($request);
$jsonobj = json_decode($response);

if($jsonobj != null)
{
	foreach($jsonobj->results as $item)
	{
		print_r($item);
		echo '<br/><br/>';
	}
}

Leave a Reply

Your email address will not be published. Required fields are marked *