Categories
PHP RSS Feeds

How to Display RSS Feeds from other websites in your PHP Page

RSS stands for Really Simple Syndication and Atom are two famous feed format. This simple php code will help you to show the RSS feeds from any website to your website. This way you can merge RSS feeds or more than one website and show them on your website

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 */

I will provide you the complete zip file of the php code very soon. Please be in touch and keep on reading.

By Vaseem Ansari

Hey guys this is Vaseem Ansari, 27 years old, Software & Web Developer, Blogger & works on Wordpress Plugin Themes Development, PHP MySql Programming and Open Sources Technologies.
It takes a while for me to build trust in someone new. I am honest, thoughtful. I'm Glad I'm Me No one looks The way I do. No one walks the way I walk. No one talks the way I talk. I am me. There's no one else I'd rather be! Have fun reading this blog and don't forget to subscribe to the feed to keep updated on the latest articles.

Leave a Reply

Your email address will not be published. Required fields are marked *