In this tutorial, i'm going to show you how to create an online rss reader using php. The concept which i'm going to discuss below will also help you in fetching data from any xml document. We know that all rss document follow same set of pattern to display feeds, so a simple foreach() loop is sufficient to display different item detail on a webpage. But, before that we should import content of rss document. simple_load_xml() function become handy in the situation. It convert the XML document into a SimpleXML object.


We'll create a rss reader using php.

In the previous tutorial, i've showed you how to create a rss document. Same rss document created as a sample their, can be converted here to a simple web page format.


$xml= simplexml_load_file("");//path to rss file
echo "Title - ".$xml->channel->title."<br>";
echo "Link - ".$xml->channel->link."<br>";
echo "Description - ".$xml->channel->description."<br>";

$item =$xml-> channel ;

foreach ( $item->item as $disp)
{ echo "<ul>";
 echo "<li>Title - $disp->title<br></li>";
 echo "<li>Link - $disp->link<br></li>";
 echo "<li>Description - $disp->description<br></li>";
 echo "</ul>";

Leave a Comment  
Download Code(40)

All rights reserved, the content is copyrighted to the author.