PDA

View Full Version : setting the Content-type to application/xml for my feed?


LJackson
06-24-2010, 11:38 PM
Hi All i have a feed which validates but it says
Feeds should not be served with the "text/html" media type so i need to change it to xml?

so i tried adding "Content-type: application/xml" to the top of my feed like so
<?php echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" "Content-type: application/xml">


but that threw up an error
XML parsing error: <unknown>:1:98: not well-formed

so my question is how do stop serving the data as text/html???

many thanks
luke

Dormilich
06-25-2010, 11:12 AM
<?php header("Content-Type: application/xml"); ?>

you could also tell your server to serve .php files as application/xml, but that would break your HTML files.

LJackson
06-25-2010, 02:28 PM
nice one thanks mate!!!