Been struggling all day trying to figure out a way to parse this xml with php:
$xml = '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:recherchePointChronopostResponse xmlns:ns1="http://cxf.rechercheBt.soap.chronopost.fr/">
<return>
<errorCode>0</errorCode>
<errorMessage>Code retour OK</errorMessage>
<listePointRelais>
<accesPersonneMobiliteReduite>true</accesPersonneMobiliteReduite>
<actif>true</actif>
<adresse1>4 RUE DE MONTESSUY</adresse1>
<adresse2/>
<adresse3/>
<codePays>FR</codePays>
<codePostal>75007</codePostal>
<coordGeolocalisationLatitude>48.8597222222</coordGeolocalisationLatitude>
<coordGeolocalisationLongitude>2.304166666670</coordGeolocalisationLongitude>
<distanceEnMetre>852</distanceEnMetre>
<identifiant>2102R</identifiant>
<indiceDeLocalisation/>
<listeHoraireOuverture>
<horairesAsString>08:00-12:00 12:00-20:00</horairesAsString>
<jour>7</jour>
<listeHoraireOuverture>
<debut>08:00</debut>
<fin>12:00</fin>
</listeHoraireOuverture>
<listeHoraireOuverture>
<debut>12:00</debut>
<fin>20:00</fin>
</listeHoraireOuverture>
</listeHoraireOuverture>
</listePointRelais>
<qualiteReponse>2</qualiteReponse>
<wsRequestId/>
</return>
</ns1:recherchePointChronopostResponse>
</soap:Body>
</soap:Envelope>';
and here is the php i use:
$soap = simplexml_load_string($xml);
$soap->registerXPathNamespace('soap', 'http://cxf.rechercheBt.soap.chronopost.fr/');
foreach ($soap->xpath('//ns1:errorMessage') as $val) {
echo $val . "<br>";
}
But i keep having a blank page!! do you please know what is wrong? I also tried to follow this post converting SOAP XML response to a PHP object or array, in vain!
Thanks