PHP DOMDocument carga tiempo de espera XML

I generate XML dynamically using this:

$domtree = new DOMDocument('1.0', 'UTF-8');
$domtree -> formatOutput = true;
$xmlRoot = $domtree -> createElement("theparent");
echo $domtree->saveXML();

I load generated xml from PHP using this

$f = "http://localhost/myapp/xml/products.php"; //full url path
$doc = new DOMDocument();


but it tooks long execution and I get this error:

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

I ever done this load XML method using same way, but why in this app I get that error? is there any special xampp or php setting? or my code is incorrect?

gracias :)

preguntado el 10 de marzo de 12 a las 13:03

btw, I'm using PHP Version 5.0.5 -

Try using absolute path to the file's path, BTW shouldn't it be products.xml ? and try the next solution: -

no, it's products.php. I generated XML dynamicaly and content-type is text/xml. btw, thank you for the link. I try it.. -

@OfirBaruch still doesn't work :( -

Trata if(!file_exists($f)) echo "the file doesn't exists"; -

1 Respuestas

Your script is attempting to download the php file, not fetch the XML output. Output to an XML file on the server and fetch that instead, or create a web service that returns the XML, then use something like cURL to use it.

respondido 10 mar '12, 14:03

yes I have done that too. I generate too products.xml and load like above and it still doesn't work :(. but I tried the comment above if(!file_exists($f)) echo "the file doesn't exists", yes why my file doesn't exists?? - Samodra

Oh. allow_url_open disabled? (But that would throw a warning anyway). Incorrect path? Strict file permissions? - Ingmar Boddington

allow_url_open is On or has 1 value in php.ini or phpinfo().. OMG what's wrong with my php #O - Samodra

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.