PHP Tutorial : Create a RSS / XMLS Feed
Mar 28, 2009 Useful PHP
Welcome,
In this tutorial I will show you how to create a basic rss / xml feed with php. Basically, if you know how to create a feed in notepad, wordpad or whatever text editor, this will be easy. The difference between creating a php xml / rss feed and a “normal” one it’s that you can do this feed dinamyc later, by extracting feed elements from a database such as MySQL.
<?php $XMLoutput = "<?xml version=\"1.0\"?> <rss version=\"2.0\"> <channel> <title>PHP RSS XML FEED</title> <link>http://www.exampledomain.com/RSS-XML-FEED.php</link> <description>RSS Feed Description</description> <language>en-us</language> <pubDate>dd/mm/yy</pubDate> <lastBuildDate>dd/mm/yy</lastBuildDate> "; $XMLoutput .= " <item> <title>A title here</title> <link>Some link here</link> <description>description goes here</description> </item>"; $XMLoutput .= "</channel></rss>"; header("Content-Type: application/rss+xml"); print $XMLoutput; ?>
Tags: dynamic feed, feed, php dynamic feed, php dynamic rss xml feed, php feed, php feed header, php header, php rss xml feed, php xml feed, rss feed, rss header, rss xml feed, xml feed, xml header


Leave a Reply