title: PHP problem with DOM parsing
body: <p>The code pasted below, works on my PC, but not on my hosting (which have PHP 5.2.13 installed).</p>
  
  <pre><code>$source = file_get_contents('http://example.com/example', 0);
  $dom = new DOMDocument;
  @$dom-&gt;loadHTML($source);
  $dom-&gt;preserveWhiteSpace = false;
  
  $xpath = new DOMXPath($dom);
  $tags = $xpath-&gt;query('//div[@class="item"]');
  
  $xml = '&lt;?xml version="1.0" encoding="UTF-8"?&gt;' . "\r\n&lt;root&gt;\r\n";
  
  foreach($tags as $tag)
      $xml .= "\t&lt;tag&gt;" . trim($tag-&gt;nodeValue) . "&lt;/tag&gt;\r\n";
  
  $xml .= '&lt;/root&gt;';
  
  $xml_file = 'tags.xml';
  $fopen_handle = fopen($xml_file, 'w+');
  fwrite($fopen_handle, $xml);
  fclose($fopen_handle);
  </code></pre>
  
  <p>On my hosting, the foreach loop doesn't executes i.e. I get only this in the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;root&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>