Web Development Blog

What is RSS feed, and how to create it

What is RSS feed, and how to generate it?

 First of all RSS is an abbreviation for Really Simple Syndication. This abbreviation is used to describe the creating feeds technology. RSS feeds also known as XML or web feeds.  This feed is frequently updated content on the website; they are used for notifying interested readers of the news or new posts in the blogs.

RSS benefits not only site owners, but readers and other webmaster.

Site owners' benefits

RSS feeds allow easily syndicate updated content, which can be grabbed by other webmasters and be displayed on their websites. In this case website content gets much more exposure through other websites.

Site webmasters benefits

Feeds allow grabbing frequently updated content from other sites, and always having up-to-date information without actually updating it.

Readers' benefits

Reader can subscribe to RSS feed in their browsers as well on the cell phone. RSS benefits readers giving them an opportunity to be notified once new content was placed on the website they are interested in.

How to create RSS feed using PHP

Basically RSS feed is just a plain text in proper format. Here is a sample RSS generation PHP script

<rss version="2.0">
<channel>
<title>Superior Web Systems</title>
<description>Welcome to our Blog, here you can find news and articles related to the IT industry</description>
<link>http://superiorwebsys.com/</link>
<copyright>2000 - <?=date('Y')?> Superior Web Systems</copyright>
<?
//DB connect file
$link = mysql_connect("localhost", "Data_Base_User", "Password") or die("Invalid query: " . mysql_error());
@
mysql_select_db("Data_Base_Name");

//SQL querry    
$sSQL="SELECT * FROM blog ORDER BY blogID DESC LIMIT 15"; //Get 15 records from DB
$result=mysql_query($sSQL) or die ("MySQL err: ".mysql_error()."<br />".$sSQL);
while(
$row = mysql_fetch_array($result))
{
    
?>
    <item>
        <title> <?=$row["title"]?></title>
        <description><?=str_replace("'","",str_replace("`","",$row['headline']))?></description>
        <link>http://superiorwebsys.com/<?=$row["blogID"]?>-<?=$titleForURL?>/</link>
        <pubDate> <?=$row['dateCreated']?></pubDate>
    </item>  
    <?
}
?>  
</channel>
</rss>

Michael Pankratov

Associated tags:  Web, Internet, Database, PHP, Website, RSS, XML, SQL, MySQL

Comments:

Michael Pankratovs wrote on April 15, 2009 at 16:13
Hello, New article explaning how to parss RSS is posted http://superiorwebsys.com/34-how-to-parse-rss-using-php-and-c/

Guys wrote on April 10, 2011 at 08:38
Mate. This blog is amazing. How can I make it look this good ?

Foxs wrote on April 18, 2011 at 21:06
Nice info ;) Thanks for your time… ;)

Delias wrote on May 31, 2011 at 09:02
You’ve got it in one. Couldn’t have put it beettr.

Lamps wrote on August 21, 2011 at 12:10
Thanks for taking the time to discuss this, I feel strongly about it and love studying extra on this topic. If possible, as you achieve expertise, would you mind updating your weblog with further data? It is extremely useful for me.

Add Comment:

CAPTCHA