If you want client browser to recognize your file.php as an XML, you need to set content-type header before outputting xml code, like this: file.php <?php header ("Content-Type:text/xml"); // ..... your code here ... ?> PHP: