How to Use an RSS Feed to Provide Content for Your Website
Search engines love websites that are continuously updated with fresh content. As a website owner, if you want to achieve or maintain a good search engine ranking, then your goal should be to continually provide updated keyword–based content on a regular basis to your website. Naturally, if you're providing the content yourself, this takes a lot of work. Let me show you how you can get fresh, keyword-based content updated on your site on a daily basis with no work on your part using RSS feeds and PHP, and most of all, the search engines will love it!
RSS is an acronym that is short for Really Simple Syndication. It's a type of XML (eXtensible Markup Language) that is used for syndicating content. XML is used to describe data and is basically a markup language – like HTML.
Before I go into the list of items that are needed to make all of this work, I will mention that the details outlined in this article apply to websites that support PHP. PHP is a popular server-side scripting language that is used to create dynamic website content. If your website is running on a Unix-based operating system (like Linux), chances are your web server supports the PHP scripting language. Check with your web host to be sure.
Now, I can make this a long drawn out article on the technical details behind RSS, XML and PHP, but that would result in a boring article that hardly anyone would read! Instead, I'll just layout the necessary details for an entrepreneurial minded individual to setup a website using these technologies in a quick and least confusing fashion, I hope.
Task: Let's say we run a website on gardening and we want to use an RSS feed to add changing content to our site on a regular basis without us having to do any work.
Here's what we need to accomplish our task:
1) An RSS feed link
2) An RSS Tool (PHP script) that can convert an RSS feed into HTML
3) An HTML output-template
Getting an RSS feed link...
A good place to start looking for an RSS feed is 2rrs.com, where you can execute an 'RSS Search' for the keyword 'gardening'. You'll likely see a bunch of results. Click on any of them. You'll now find an RSS2HTML link under the 'Details' section - which is your RSS feed link. Copy the full HTTP path to this link; we will need it for configuration in later steps.
Now we need to get an RSS Tool (PHP script) that can convert an RSS feed into HTML, and we also need an HTML output-template…
So, we need a method to take our RSS feed and convert it into HTML so we can insert it into our web page. The best way to do this is to use an awesome little PHP script called rss2html.php.
You can download this script here: http://www.feedforall.com/more-php.htm
(Choose Option two -> Download)
Unzip the download file and you'll find a sample HTML output-template file called sample-template.html and an rss2html.php file. These files will eventually need to be moved to your web server, but before you do that, let's configure everything...
The PHP file is the work horse and does the RSS XML to HTML conversion, so there are some configuration settings within this file that need to be set. Open the file in a regular text editor (like Word Pad) and make the following 3 configuration changes:
Configuration change #1:
Find the following line of code: $XMLfilename = "sample.xml";
Change it to: $XMLfilename = "Your-RSS-Feed-Link";
The above line of code tells the PHP script where to get your RSS XML feed (file). Remember, the RSS XML feed contains the content which you are trying to add to your website. The website that you get your RSS feed from will update this feed as new content becomes available from the website. (Note: be sure not to download the XML file and specify a local path to it – this will result in your website always using the same XML file – which means your website will not be updated with new content from the RSS XML source.)
Configuration change #2:
Find the following line of code: $TEMPLATEfilename = "sample-template.html";
Insert your HTML output-template name in place of sample-template.html.
The rss2html.zip that you downloaded from the feedforall link above comes with a sample-template.html that you can use. However, the template from feedforall encompasses the entire HTML code for the entire webpage (from the opening 'html' tag to the closing 'html' tag). If you're inserting this content into your pre-existing webpage, then you'll likely only want to use the HTML code between the opening 'table' tag and the closing 'table' tag. This will allow you to insert a table into your webpage where each row represents an article from your RSS XML feed source.
Configuration change #3:
Find the following line of code: $FeedMaxItems = 10000;
The number '10000' above represents the number of items that you want to retrieve from the RSS feed – which works out to be the number of rows in your HTML table from the previous step. You can leave this setting as is, or you can change it to any positive number your like. For example, if you change it to 5, then the PHP script will display the top 5 RSS feed articles from your RSS feed source.
When you're done with these configuration settings you can upload these files to your scripts directory on your web server and add the following line of code to your website's HTML file where you would like the RSS feed content to appear:
Make sure to prefix the above line of code with a 'less-than' symbol followed by a question mark, as well as, postfix it with a question mark followed by a 'greater-than' symbol. Also, remember, if your webpage was initially an html file (i.e. filename.html) then you will want to change it to filename.php in order for the web server to know how to handle the above PHP script.
There you go... an easy way to add changing content to your website without any extra work on your part.
About the Author: Michael Ellis is an Internet technology expert that specializes in marketing products and services online. Be sure to visit Michael's website http://www.VictoryKey.com for FREE Internet Marketing articles, tips and discussion forums.
Want a quality website critique? Simply post a request in Michael's Internet Marketing Forum to get a valuable review of your website.