[eluser]eoinmcg[/eluser]
assuming you're using php5, here's some code i put together recently:
Code:
$tweets = get_tweets('starfishweb');
foreach($tweets as $tweet)
{
var_dump($tweet);
}
function get_tweets($twitter_name, $count=3)
{
$url = "http://twitter.com/statuses/user_timeline/$twitter_name.xml";
@$xml = simplexml_load_file($url);
if ( !$xml )
{
return $this->error();
}
$data = array();
$n = 1;
foreach ( $xml->status as $status )
{
// convert this to a unixtimestamp
$date = strtotime( (string) $status->created_at);
$data['tweets'][$n]['time'] = date('d M H:i', $date);
$data['tweets'][$n]['text'] = auto_link($status->text); // you should load the url helper to make use of autolink
$n++;
}
return array_slice($data['tweets'], 0, $count);
}
there's room for improvement but you get the idea.
you're obviously going to want to cache, given the timelag in fetching the data from twitter