Simple rss feed

I'm trying to make a simple rss channel, but the problem is that when I run the file, you say you want to open rss.php ...

here is the code, maybe I'll do something wrong? I put it in this format to see how it works.

<?php header('Content-Type: application/rss+xml; charset=utf-8'); ?> &#60;?xml version='1.0' encoding='ISO-8859-1'?&#62; <rss version='2.0'> <channel> <title>feed title</title> <description>this is my example</description> <link>http://localhost:8888/redline</link> <copyright>Copyright (C) 2010 sarmenhb</copyright> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> </channel> </rss> 
+4
source share
1 answer

You should output the real <?xml version='1.0' encoding='ISO-8859-1'?> And not the permitted version. Since this is a problem due to php own <? , echo after the header:

 <?php //header('Content-Type: application/xml'); header('Content-Type: application/rss+xml; charset=utf-8'); echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <rss version='2.0'> <channel> <title>feed title</title> <description>this is my example</description> <link>http://localhost:8888/redline</link> <copyright>Copyright (C) 2010 sarmenhb</copyright> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> <item> <title>Example 1</title> <description>This is the description of the first example.</description> <link>http://www.example.com/example1.html</link> <pubDate>Mon, 29 Dec 2008 22:10:00 -0600</pubDate> </item> </channel> </rss> 
+11
source

All Articles