I'm trying to parse a SOAP response from a server (Chronopost WebServices) but I really don't know what I am messing up. The question has been asked many times but I can't find any answer that works.
The response looks like below :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:rechercheBtParCodeproduitEtCodepostalEtDateResponse xmlns:ns1="http://cxf.rechercheBt.soap.chronopost.fr/">
<return>
<adresse1>42 RUE SAINT DENIS</adresse1>
<codePostal>28100</codePostal>
<dateArriveColis>2016-09-25T10:46:30.778+02:00</dateArriveColis>
<horairesOuvertureDimanche>08:00-13:00 00:00-00:00</horairesOuvertureDimanche>
<horairesOuvertureJeudi>07:15-12:00 12:00-20:00</horairesOuvertureJeudi>
<horairesOuvertureLundi>07:15-12:00 12:00-20:00</horairesOuvertureLundi>
<horairesOuvertureMardi>07:15-12:00 12:00-20:00</horairesOuvertureMardi>
<horairesOuvertureMercredi>00:00-00:00 00:00-00:00</horairesOuvertureMercredi>
<horairesOuvertureSamedi>08:00-12:00 12:00-20:00</horairesOuvertureSamedi>
<horairesOuvertureVendredi>07:15-12:00 12:00-20:00</horairesOuvertureVendredi>
<identifiantChronopostPointA2PAS>2924P</identifiantChronopostPointA2PAS>
<localite>DREUX</localite>
<nomEnseigne>LE LONGCHAMP</nomEnseigne>
<coordGeoLatitude>48.7344444</coordGeoLatitude>
<coordGeoLongitude>1.37138888</coordGeoLongitude>
<urlGoogleMaps>http://maps.google.fr/maps?q=48.7344444,1.37138888</urlGoogleMaps>
</return>
I've tried to parse this file in PHP with :
$response = file_get_contents('https://ws.chronopost.fr/recherchebt-ws-cxf/PointRelaisServiceWS/rechercheBtParCodeproduitEtCodepostalEtDate?codePostal=28500&date=27/09/2016');
$clean_xml = str_ireplace(['SOAP-ENV:', 'SOAP:'], '', $response);
$xml = simplexml_load_string($clean_xml);
var_dump($xml);
Which returns me an empty object and I don't get why :
object(SimpleXMLElement)#287 (1) {
["Body"]=>
object(SimpleXMLElement)#280 (0) {
}
}
Edit : some more informations : working with Laravel 5.2 and its server (php artisan serve
). No errors reported in the console log.