Creating rss feed with php

Hi

I have created a php file called feed.php.
This code calls my database and creates output for a feed.

The link to my file is: http://ectpro.co/dev-stefan/feed.php

I don’t think I did this correctly.

Also, what is the next step on getting the contents to show up in a feed?

Thanks.

Get rid of the blank line at the top. Also make sure to set the appropriate headers.

header('Content-Type: application/rss+xml; charset=ISO-8859-1');

Hi Kath,

Your code seems fine except for the last part:


<html>
<head>
<link rel="alternate" href="/feed/" title="My RSS Feed" type="application/rss+xml" />
</head>

<body>
	<?php
	  print ($sFeed);
	?>
</body>
</html>

You can't output XML inside an HTML document.

Just delete that part and tell us if it worked.

HTH