<?php
function parse($text) {
$text = preg_replace('#
http://[a-z0-9._/-]+#i', '
$0', $text);
$text = preg_replace('#@([a-z0-9_]+)#i', '@
$1', $text);
$text = preg_replace('# \#([a-z0-9_-]+)#i', ' #
$1', $text);
return utf8_encode($text);
}
$user = "username";
$count = 8;
$date_format = 'd M Y, H:i:s';
$url = 'http://twitter.com/statuses/user_timeline/'.$user.'.xml?count='.$count;
$oXML = simplexml_load_file( $url );
echo '<ul>';
foreach( $oXML->status as $oStatus ) {
$datetime = date_create($oStatus->created_at);
$date = date_format($datetime, $date_format)."\n";
?>
<h2><?php echo ' (
'.$date.')'; ?></h2>
<?php
echo parse(utf8_decode($oStatus->text));
?>
</p>
<?php
}
?>