Skip to content

Instantly share code, notes, and snippets.

@zachbrowne
Created October 31, 2011 06:49
Show Gist options
  • Save zachbrowne/1327044 to your computer and use it in GitHub Desktop.
Save zachbrowne/1327044 to your computer and use it in GitHub Desktop.
Generate RSS feed with PHP
<?php
$XMLoutput = "<?xml version=\"1.0\"?>
<rss version=\"2.0\">
<channel>
<title>PHP RSS XML FEED</title>
<link><a class="linkclass" href="http://www.exampledomain.com/RSS-XML-FEED.php">http://www.exampledomain.com/RSS-XML-FEED.php</a></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;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment