Monday, 27 May 2013

Get tweets from twitter

How to get tweets in twitter


<?php
function get_tweet($username, $numberTweets)
{
$output = "";
$displayed = 0;
$url = "http://search.twitter.com/search.atom?q=from:$username&rpp=$numberTweets";
$xml = simplexml_load_file($url);
return $xml;
}
$tweet = get_tweet('your_name', 5);
foreach($tweet as $tweets){
echo $tweets->content.'<br />';
}
?>

No comments:

Post a Comment