Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Twitter RSS on your site


henry0 - 5:02 pm on Mar 2, 2012 (gmt 0)


Thanks to RonPK for adding the crucial tweaks!

Note:don't know why the the boxed comments on this post
are not showing as a neat rectangle.

<?php
###################################################################
# This snippet utilises a PHP native class.########################
# ManyThanks to Webmasterworld member RonPK for his collaboration##
###################################################################

// $feed_url replace YOUR TWITTER USERNAME.rss
// by your own username

class CeiXML extends SimpleXMLElement{
public function asHTML(){
$ele=dom_import_simplexml($this);
$dom = new DOMDocument('1.0', 'utf-8');
$element=$dom->importNode($ele,true);
$dom->appendChild($element);
return $dom->saveHTML();
}
}
echo"<table width='200'>";
//Define feed URL
$feed_url = 'https://twitter.com/statuses/user_timeline/YOUR TWITTER USERNAME.rss';
//Get content of the URL
$content = file_get_contents($feed_url);
//Prase feeds into class

$feeds = new CeiXML($content);
printf('<tr><td><strong><a href="%s" title="%s">%s</a></strong></td></tr>', $feeds->channel->link, $feeds->channel->title, $feeds->channel->title);
echo '<tr><td><ul>';
foreach($feeds->channel->item as $item) {
printf('<li><a href="%s">%s</a><br>%s</li>' . PHP_EOL, $item->link, $item->pubDate, $item->title);
}
echo '</ul></td></tr></table>';

?>


Thread source:: http://www.webmasterworld.com/php/4421048.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com