Join Login


Video Tutorials
Blog




Twitter API


By: RiverCityGraphix      Views: 4464      Share: Bookmark and Share

In this tutorial, you will learn how to retrieve data from the Twitter API using PHP and then output it.

Twitter has become increasingly popular and often you will want to display your tweets or other information on your site. This tutorial shows you how to gain access to the XML feed from the Twitter API and use it to output your data.

<?php
$xmldata = 'http://twitter.com/statuses/user_timeline/RiverCityGraphx.xml';
$open = fopen($xmldata, 'r');
$content = stream_get_contents($open);
fclose($open);
$xml = new SimpleXMLElement($content);
?>

<table width="550" border="1">
<tr>
<td><? echo $xml->status[0]->text; ?> at <? echo $xml->status[0]->created_at; ?></td>
</tr>
</table>



Demo File

Free Source Files Zip

Yahoo! Small Business