title: How to parse SOAP response in PHP
body: <p>I have cracked my head the last few days trying to parse a soap response (via curl command-line), but I can not get it to work. I just want to get the object value of <code>ResourceIdentifier</code> which is <strong>rs-1304500829200-200</strong>. I am using PHP 5.3.x</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;soap:Body&gt;
      &lt;ns2:deliverMDRecordsResponse xmlns:ns2="http://mdstore.data.dnetlib.eu/" xmlns:ns3="http://www.w3.org/2005/08/addressing"&gt;
        &lt;return&gt;
          &lt;ns3:Address&gt;http://129.70.12.20:8282/dnet-mdstore/services/MDStoreResultSet&lt;/ns3:Address&gt;
          &lt;ns3:ReferenceParameters&gt;
             &lt;ResourceIdentifier:ResourceIdentifier xmlns:ResourceIdentifier="http://www.driver.org" xmlns:wsa="http://www.w3.org/2005/08/addressing"&gt;rs-1304500829200-200&lt;/ResourceIdentifier:ResourceIdentifier&gt;
         &lt;/ns3:ReferenceParameters&gt;
          &lt;/return&gt;
       &lt;/ns2:deliverMDRecordsResponse&gt;
     &lt;/soap:Body&gt;
   &lt;/soap:Envelope&gt;
  
  &lt;?
   $response=&lt;&lt;&lt;END ....soap response here... END; 
  
   $xml = simplexml_load_string($source);
   $xml-&gt;registerXPathNamespace('t', 'http://www.driver.org'); 
   foreach ($xml-&gt;xpath('//t:ResourceIdentifier') as $item)    
   { //  print_r($item);       
       echo $item-&gt;asXML();    
   }    
  ?&gt;
  </code></pre>