iEntry 10th Anniversary RSS Newsletter Advertising
Join the WebProWorld Forum!

RSS feeds - Adding a Feed to a Website Using PHP

Post to Twitter Post to Facebook

Adding an rss feed to your website is not as difficult as most people believe.

The great thing about adding RSS feeds to your website is that the feed can keep your page content updated automatically since you are 'streaming' information directly from another website to your page!

The method of adding RSS feeds discussed below involves the use of PHP and HTML.

To get started with streaming an RSS feed, you need to download a package called RSS2HTML which makes it easy to add feeds to your website.

You can download the RSS2HTML package from http://www.feedforall.com/download.htm Once the files are unzipped, upload the php file rss2html.php to your server.

RSS2HTML uses templates to define how the news feed should be displayed, so you will also have to upload the template file included in the package to your server (template1.html). Once those files have been uploaded, loading an RSS file is easy!

Choose the HTML file you would like the RSS file to be loaded in, and rename the file to have an extension of .php instead of .htm Next, include the code snippet below in your new php file *MAKE SURE THAT THE CODE IS ON ONE LINE*

<?php include('http://www.yourserver.com/rss2html.php?XMLFILE=http://ww w.searchenginewatch.com/sew.xml&TEMPLATE=http://www.yourserver.or g/template1.html&MAXITEMS=20 target="_blank">'); ?>

Let me explain what's going on in the code above; the first URL rss2html.php, is the path where you have uploaded your rss2html file;

the XMLFILE variable is the URL of the RSS news feed,

the TEMPLATE variable contains the URL of the template which defines how the news feed should be displayed. You can edit this in notepad if you want.

The MAXITEM variable defines how many items in the RSS feed should be displayed. (For more information about items in news feeds, consult the 'Making an RSS feed' article)

That's all there is to it! The php file should read the XML RSS file and display the contents using the template file.

As for where to find RSS feeds to add to your website? The main place I head to find RSS feeds is the Octora RSS feed search engine at http://www.octora.com You can type in a keyword; and hundreds if not thousands of feeds are usually produced for the keyword. Other places also include Bloglines and Technorati.

That said, go on and have fun adding feeds to your website!

Tag:

Add to Del.icio.us | Digg | Yahoo! My Web | Furl

Bookmark WebProNews:

Kevin Allman is webmaster with over ten years Internet experience. He runs a Search Engine Optimization website at http://www.pzeta.org/seo_global/ which contains many articles on how to optimize your website. He also has been involved with search engine technology and has developed mini search engines throughout the past few years.

News Tags: Search, Engine, Website, HTTP, RSS, Feeds, PHP
About the author:
Kevin Allman is webmaster with over ten years Internet experience. He runs a Search Engine Optimization website at http://www.pzeta.org/seo_global/ which contains many articles on how to optimize your website. He also has been involved with search engine technology and has developed mini search engines throughout the past few years.

5 Comments

Video RSS feeds

Are there any video only RSS feeds that are available?

failed to open stream

Hi i've added as per the steps u've mentioned but im getting error like 'failed to open stream'.
what could be the reason?
my page is
http://www.codepal.co.in/TestFeed.php
please reply me @ binobose@gmail.com

Thanks, this is what I was looking for

Thanks again. This is good because now I can add RSS feeds to my site :)

 

rss feeder

Hi  thanks

Can you limit the frequency

Can you limit the frequency of updating an RSS feed on a web site so that it's maybe once daily vs. instantly?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 9 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Featured Headline
Fake Chrome OS Screenshots Punk Tech Media
Mystery Blogger Comes Clean
5 comments | 20 hours ago
 
Subscribe to WebProNews


Send me relevant info