tags:

views:

42

answers:

2

I am trying to parse an xml document I created in a php file and outputted using

echo $xmlMysql->saveXML();

using cURL I send the information over, but when I try and parse it through using the following code.

 $xmlDoc = download_page($url);
  $dom = new DomDocument();
  $dom->load($xmlDoc);
  echo $dom->saveXML();

I get this error message,

<b>Warning</b>:  I/O warning : failed to load external entity 
^

any help with this would be much appreciated

A: 

You can do

$dom = new DomDocument()
$dom->resolveExternals = false;
//...

to prevent external entities from being resolved. Of course, you may want to investigate which external entities are not being read. See also libxml_disable_entity_loader.

Artefacto
A: 

if $xmlDoc is a string of XML that you're getting from an HTTP request, try using the loadXML method instead of just load method of your DomDocument object.

Matthew J Morrison