HOME BLOG PORTFOLIO PHOTO CONTACT
Creating a Custom RSS Feed with PHP and MySQL

<?PHP
//SET XML HEADER
header(‘Content-type: text/xml’);

//CONSTRUCT RSS FEED HEADERS
$output = ‘<rss version=”2.0″>’;
$output .= ‘<channel>’;
$output .= ‘<title>Comments for JAY BHARAT</title>’;
$output .= ‘<description>Software Engineer. Thankyou for visiting my blog page.</description>’;
$output .= ‘<link>http://www.moonreturn.com/</link>’;
$output .= ‘<copyright>Copy Right or Left who cares!</copyright>’;

//LOOP BODY OF RSS FEED

$output .= ‘<item>’;
$output .= ‘<title>Item Title</title>’;
$output .= ‘<description>Item Description</description>’;
$output .= ‘<link>http://www.moonreturn.com</link>’;
$output .= ‘<pubDate>24 May 2010 17:31</pubDate>’;
$output .= ‘</item> ‘;

$output .= ‘<item>’;
$output .= ‘<title>Item Title</title>’;
$output .= ‘<description>Item Description</description>’;
$output .= ‘<link>http://www.moonreturn.com</link>’;
$output .= ‘<pubDate>24 May 2010 17:31</pubDate>’;
$output .= ‘</item> ‘;
//LOOP BODY OF RSS FEED CLOSE

$output .= ‘</channel>’;
$output .= ‘</rss>’;

//SEND COMPLETE RSS FEED TO BROWSER
echo($output);

?>

   Share on Facebook

Page views:304