I have this site. www.proxywhereabouts.com/old/ and on this page, I have made it to show 25 latest submission. www.proxywhereabouts.com/old/recent.php Now, I want to publish rss so that people can easily update themselves with the newest submission without having to go to the page. This is what I have done so far. <?php require ('config.php'); $dbconnect = mysql_pconnect($db_host, $db_user, $db_pass); mysql_select_db($db_name, $dbconnect); $query = "select url, category, time, hits from `submission` order by `time` DESC limit 25"; $result = mysql_query($query, $dbconnect); while ($line = mysql_fetch_assoc($result)) { $return[] = $line; } $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\" xmlns:admin=\"http://webns.net/mvcb/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"> <channel> <title>ProxyWhereabouts.com Latest Proxies</title> <link>http://www.proxywhereabouts.com/old/pwrss.php</link> <description>25 newest proxies submitted on ProxyWhereabouts.com</description> <dc:language>en-ca</dc:language> <dc:creator>admin@proxywhereabouts.com</dc:creator> <dc:rights>Copyright 2007-2008</dc:rights> <admin:generatorAgent rdf:resource=\"http://www.proxywhereabouts.com/rss.php\" /> "; foreach ($return as $line) { $output .= "<item><title>".htmlentities($line['url'])."</title> <link>".htmlentities($line['url'])."</link> <guid>".htmlentities($line['url'])."</guid> <description>".htmlentities(strip_tags($line['category']))."</description> </item>"; } $output .= "</channel></rss>"; header("Content-Type: application/rss+xml"); echo $output; ?> PHP: Here is the result. http://www.proxywhereabouts.com/old/rss.php As you can see from the rss page, it only show the original submitted link and type of proxy. I want to show it better such as: Script: PHProxy | Country: US | Date Submitted: August 15 2008 04:25 | Hits: 2542 How could I do that? How to use any html in rss feed? Any idea?
I am not sure if I got you right, but I THINK you want to have formatted HTML in your <description> field. As far as I can see, at the moment you are stripping all the tags out, but wouldn't you just insert the HTML you mentioned IN the description field? No, it won't work if you just put the HTML in there, so enclose it in a <![CDATA[ ]]> block. Not sure if that's how you are supposed to do it! But it validates, and it works too - just did it yesterday for THIS feed, so have a look at the source.
When formatted in html, it gave me error. Other than application/rss+xml format, how to use it as text/html format?