Menampilkan status twitter di website kita

1. Silakan Anda cek id twitter anda di http://www.idfromuser.com

2. XML document :
Contoh ID :  218392201
Ketikkan Pada Url anda : http://twitter.com/statuses/user_timeline/218392201.rss
Maka Akan Tampil seperti berikut :


 <item>
<title>...</title>
<description>...</description>
<pubDate>...</pubDate>
<guid>...</guid>
<link>...</link>
<twitter:source>...</twitter:source>
<twitter:place/>
</item>

3. Membaca data XML dengan php :


<?php $idTwitter ='218392201';
$xml = simplexml_load_file("http://twitter.com/statuses/user_timeline/".$idTwitter.".rss");
foreach($xml->channel->item as $data)
{
echo "<p>";
echo $data->pubDate."<br>";
echo $data->title;
echo "</p>";
}
?>

4. Membaca status akhir :


<?php
$idTwitter = '218392201';
$showStatus = 5;
$xml = simplexml_load_file("http://twitter.com/statuses/user_timeline/".$idTwitter.".rss");
$counter = 1;
foreach($xml->channel->item as $data)
{
echo "<p>";
echo $data->pubDate."<br>";
echo $data->title;
echo "</p>";
if ($counter == $showStatus) break;
else $counter++;
}
?>