I have a php code that fetches my latest tweet and displays it on my website. It works great but I would like to know if I could do this but maybe fetching my 5 last tweets instead of only the latest. This is my code for twitter.php:
function returnTweet()
{
$username = "username";
$prefix = "<div><big><i><a href=\"http://twitter.com/$username\">@$username</a> ";
$suffix = "</i></big></div>";
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=5";
$twitterFeed = file_get_contents($feed);
$tweet = parse_feed($twitterFeed);
return $prefix.$tweet.$suffix;
}
function parse_feed($feed)
{
$stepOne = explode("<content type=\"html\">", $feed);
$stepTwo = explode("</content>", $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace("<", "<", $tweet);
$tweet = str_replace(">", ">", $tweet);
return $tweet;
}
And i display it in my php page like this:
include "twitter.php";
echo "".returnTweet();
Would appreciate any help in this! Regards from Paparappa