Getting your latest twitter status using PHP

0Comments
<?php
 
function getTwitterStatus($userid){
$url = "http://twitter.com/statuses/user_timeline/$userid.xml?count=1";
 
$xml = simplexml_load_file($url) or die("could not connect");
 
       foreach($xml->status as $status){
       $text = $status->text;
       }
       echo $text;
 }
 
 
getTwitterStatus("insert.twitter.username.here");
 
/*Put your twitter ID above in the brackets*/
 
?>