RSS stands for Really Simple Syndication and Atom are two famous feed format.
If you open any RSS Feed page, first line starts with < ?xml … ?> and then and at the end .
So anything inside and is feed data.
Every content is placed under .
So all we need to do is read information inside and display it.
Here is a sample program that does it.
/* Our Code Starts Here */
//Enter the Feed url as parameter to function
$xml = simplexml_load_file(”http://www.vaseemansari.com/blog/feed”);
//To check if the read document is a rss feed
if($xml->channel->item)
{
$contents = $xml->channel->item;
foreach($contents as $content)
{
echo $content->title;
echo $content->description;
}
}
else
{
echo “Invalid RSS Format”;
}
/* Our Code Ends Here */
No comments:
Post a Comment