How to add RSS feeds into your website using PHP

Hello Friends,
As a webmaster you would interested in having search engine friendly RSS feeds on your web pages because this can help with;

RSS in Javascript format is available from most RSS Publishers but what they do not tell you is that Javascript is not search engine friendly. What that means is search engines do not read Javascript. Any thing placed on your web pages in javascript format won't be read by the indexing search engines. That is why they offer our feeds in PHP. PHP is a search engine friendly scripting language. Adding RSS feeds to your web pages with PHP will provide fresh content for the search engines to choose up and rank you for.

PHP is server side scripting. That means it is parsed on the server before your page lots in the browser. To the visitor and to the search engines PHP scripts are not noticeable. When PHP is combined with RSS feeds it is a powerful idea. 

With PHP and RSS you can add other people's content to your web pages and the search engines will see it and think it is part of your net site! That free RSS content when placed on your web page with PHP will fundamentally become a part of your web-site and bring you more traffic. That is why they recommend that you add the feeds to your net site with PHP in lieu of Javascript. Follow the instructions below to add the code to your web pages.  Getting spidered more often Rating higher in the search engines  Adding Relevancy to your web page.

I had a lot of trouble trying to add RSS Feeds on my website. Eventually I came across these codes and they were very helpful.
PHP Code:
class RSSFeed {
// channel vars
var $channel_url;
var $channel_title;
var $channel_description;
var $channel_lang;
var $channel_copyright;
var $channel_date;
var $channel_creator;
var $channel_subject;
// image
var $image_url;
// items
var $items = array();
var $nritems;
// constructor
function RSSFeed() {
// set channel vars
function SetChannel($url, $title, $description, $lang, $copyright, $creator, $subject) {
// set image
function SetImage($url) {
// set item
function SetItem($url, $title, $description) {
// output feed
function Output() {
$output =  '{C}{C}{C}'."\n";
$output .= ''."\n";
$output .= ''."\n";
$output .= ''.$this->channel_title.''."\n";
$output .= ''.$this->channel_url.''."\n";
$output .= ''.$this->channel_description.''."\n";
$output .= ''.$this->channel_lang.''."\n";
$output .= ''.$this->channel_copyright.''."\n";
$output .= ''.$this->channel_date.''."\n";
$output .= ''.$this->channel_creator.''."\n";
$output .= ''.$this->channel_subject.''."\n";

$output .= ''."\n";
$output .= '';
for($k=0; $k<$this->nritems; $k++) {
$output .= ''."\n";
$output .= ''."\n";
$output .= ''."\n";
$output .= ''."\n";
$output .= ''."\n";
for($k=0; $k<$this->nritems; $k++) {
$output .= ''."\n";
$output .= ''.$this->items[$k]['title'].''."\n";
$output .= ''.$this->items[$k]['url'].''."\n";
$output .= ''.$this->items[$k]['description'].''."\n";
$output .= ''.$this->items[$k]['url'].''."\n";
$output .= ''."\n";
$output .= ''."\n";
return $output;
You would use it like this :
php Code:
$myfeed = new RSSFeed();
'My feed name',
'My feed description',
'My copyright text',
'my subject');
echo $myfeed->output();
I also discovered that there was a cron script that runs every now and then that writes the output to a an xml file.  It ran through a feed validator and was validated.
For more information :- Custom  Facebook Website Design   Front Page Designer search on twitter

About the Author:

Narottam Agarwala

 Narottam Agarwala

About Author