Return to Snippet

Revision: 19839
at November 1, 2009 17:28 by rickfu


Initial Code
<?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;
 }

//my user id USERNAME
getTwitterStatus("USERNAME");

?>

Initial URL
http://css-tricks.com/snippets/php/get-latest-twitter-status/

Initial Description
via @kenrick1991

Initial Title
Get Latest Twitter Status

Initial Tags
php, twitter

Initial Language
PHP