我用这个动态生成XML:
$domtree = new DOMDocument('1.0', 'UTF-8');
$domtree -> formatOutput = true;
$xmlRoot = $domtree -> createElement("theparent");
bla..bla..bla..
echo $domtree->saveXML();
我使用此
从PHP加载生成的xml$f = "http://localhost/myapp/xml/products.php"; //full url path
$doc = new DOMDocument();
$doc->load($f)
bla..bla..bla ..
但是执行时间很长,我收到了这个错误:
Warning: DOMDocument::load(http://localhost/myapp/xml/products.php) [function.load]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in F:\xampp\htdocs\myapp\loader\loadxml.php on line 14
Fatal error: Maximum execution time of 60 seconds exceeded in F:\xampp\htdocs\myapp\loader\loadxml.php on line 16
我曾经用同样的方式完成了这个加载XML方法,但为什么在这个应用程序中我得到了这个错误?是否有任何特殊的xampp或php设置?或者我的代码不正确?
谢谢你:)答案 0 :(得分:0)
您的脚本正在尝试下载php文件,而不是获取XML输出。输出到服务器上的XML文件并获取它,或者创建一个返回XML的Web服务,然后使用类似cURL的东西来使用它。