DOM with SimpleXML Doesnt show the data in XML format in Browser using PHP

白昼怎懂夜的黑 提交于 2019-12-02 11:41:57

It's a matter of the Content-Type HTTP header. The second link uses the application/xml while the first one uses php's default text/html. You can change your php script's HTTP headers with the header() function.

header('content-type: application/xml');

EDIT:

I've been able to fetch the original input, the only the header doesn't made it work (at least in firefox), got parse error on line 48580, this is due no encoding was set to the DOMDocument object, while the original input is in utf-8. With

$doc = new DOMDocument('1.0', 'utf-8');

should work.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!