Generating XML with PHP
by satheesh[ Edit ] 2010-01-29 20:38:12
Generating XML with PHP
To generate an XML response from the server using PHP, use following code:
<?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='ISO-8859-1'?>";
echo "<note>";
echo "<from>Jani</from>";
echo "<to>Tove</to>";
echo "<message>Remember me this weekend</message>";
echo "</note>";
?>
Note: - that the content type of the response header must be set to "text/xml".