ForeverSJC ForeverSJC - 1 year ago 178
PHP Question

How to echo <?xml version="1.0" encoding="utf-8"?> in a page?

I'm using a script to display a page in XML, but I need it to display at start but whenever I try, it breaks the code.

Heres the code I tried:

header('Content-Type: application/xml');
$output = "
<?xml version='1.0' encoding='utf-8' ?>
print ($output);

but its not working, any help ?

Answer Source

use echo , Basic Simple XML

 header('Content-Type: application/xml');
 $output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 echo $output;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download