$uname = "YourUserName";
$url = "http://twitter.com/statuses/user_timeline/$uname.rss";
$rss = @file_get_contents($url);
if($rss)
{
$xml = @simplexml_load_string($rss);
if($xml !== false)
{
foreach($xml->channel->item as $tweet)
{
echo $tweet->pubDate."\n";
echo substr($tweet->description,10)."\n";
}
}
else
{
echo "Error: RSS file not valid!";
}
}
else
{
echo "Error: RSS file not found, Invalid username";
}
?>
No comments:
Post a Comment