title: how can I parse xml data in php
body: <p>I am trying to find out how this would work</p>
  
  <p>For testing purposes, I have made two websites.</p>
  
  <p>One is calling a REST service from the other</p>
  
  <p>I pull the xml data with file_get_contents</p>
  
  <p>if I echo it, I can see a string off data.</p>
  
  <p>But how can I use simpelxml on it, extract data from the nodes themselves?</p>
  
  <p>If I use simplexml_load_file($url), I get some error saying xml declaration only allowed
  at the start off the document?</p>
  
  <p>I have this in my testfile</p>
  
  <pre><code>&lt;?php
  
  $url='http://www.woonbel.nl/gps/setgpsloc';
  //not working
  $xml =simplexml_load_file($url);   
  
  print_r($xml);
  
  //just a string
  $xml=file_get_contents($url);
  echo "&lt;h3&gt;$xml&lt;/h3&gt;&lt;br&gt;";
  
  ?&gt;
  </code></pre>
  
  <p>this was the xml I send.</p>
  
  <p>I send this from a class file that I included in the top off my php file
  if I am sure the webservice is called, maybe that has someting to do with the declaration error?</p>
  
  <pre><code>header('Content-type: text/xml');
  echo "&lt;?xml version=\"1.0\"?&gt;\n";
  echo "&lt;response&gt;\n";
  echo "\t&lt;status&gt;$status_code&lt;/status&gt;\n";
  echo "\t&lt;fout&gt;Geen&lt;/fout&gt;\n";
  echo "&lt;/response&gt;";
  </code></pre>
  
  <p>Thanks, Richard</p>