Generating XML with PHP

by satheesh 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".

Tagged in:

1000
like
0
dislike
0
mail
flag

You must LOGIN to add comments