<?php
//Get Latest Tweet
// All credit to Wardell / http://blog.wardelldesign.com/php/get-latest-tweet-with-php
// Mods made by Ryan Cooper
function latest_tweet($username,$tweetnumber){
$url = "http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=$username&count=10";
$xml = simplexml_load_file($url);
$mytweet = $xml->status[$tweetnumber]->text;
$firstChar = substr($mytweet, 0, 1);
//Exclude @ replies
if($firstChar == "@"){
//If this tweet is an @ reply move on to the previous one
while ($firstChar == "@"){
$tweetnumber++;
$mytweet = $xml->status[$tweetnumber]->text;
$firstChar = substr($mytweet, 0, 1);
if($firstChar != "@"){
//If the previous tweet is not an @ reply output it
return $mytweet;
}
}
}else{
//If first tweet is not an @ reply output it
return $mytweet;
}
}
//End Get Latest Tweet

//output
echo latest_tweet('wardelldesign', 0);
?>