Posted by: Md. Masud | October 29, 2007

Creating RSS Feed [Beganing]

RSS Feed is one of the best thing in modern web world. But most of the time we are not able to create our own RSS Feed. But can you imagine its simply easy when you know how to write them. Here is a beganing example to write a RSS Feed:

<?php

header( ‘Content-type: text/xml’);

?>

<rss version=”2.0″>
<channel>
<title> WordPress </title>
<description> This is a test site for WordPress </description>
<link> phpprogrammerofbangladesh.wordpress.com </link>

<?php

mysql_connect( ‘localhost’, ‘root’, ” ) or die( mysql_error() );
mysql_select_db( ‘wordpress’) or die( mysql_error() );

$sql_query = “select ID, post_date, post_title, post_content from wp_posts ORDER BY post_date DESC LIMIT 0,5″;

$result     = mysql_query( $sql_query );
while( $row = mysql_fetch_row( $result ) )
{
?>
<item>
<title>       <?=htmlentities(strip_tags($row[2]));?>             </title>
<description> <?=htmlentities( strip_tags($row[3]) );?>           </description>
<link> http://localhost/wordpress/index.php?post_id=<?=$row[0];?> </link>
<pubDate>     <?=$row[1];?>                                       </pubDate>
</item>
<?php
}
?>
</channel>
</rss>

You can have more details about RSS Feed Creation from the following links

  • http://www.tiffanybbrown.com/2005/12/22/dynamic-rss-feeds-using-php-mysql-and-apache
  • http://www.owalog.com/blog.php?myess1=47
  • http://www.tutorialized.com/view/tutorial/Creating-Dynamic-RSS-Feeds-with-PHP-and-MySQL/15948
  • http://www.devshed.com/c/a/MySQL/Creating-an-RSS-Reader-the-Reader/

Responses

Feed Editor by Extralabs Software is great for making RSS

Helpful instruction
keep all the good works going… buddy :)

Leave a response

Your response:

Categories