[SimpleXML] Charger contenu XML
Bonjour,
Sur une URL distant, je dois chargé le contenu d'une page. Le contenu de la page est modifié selon le contenu passé en GET à l'url.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns1:trackResponse xmlns:ns1="http://chargeur.tracking.geopost.com/">
<return>
<errorCode>0</errorCode>
<eventCode>AAAAAA</eventCode>
<eventDate>10/10/01</eventDate>
<eventLibelle>Rendu</eventLibelle>
<eventSite>Paris</eventSite>
<recipientCity></recipientCity>
<recipientCountryCode>FR</recipientCountryCode>
<recipientZipCode>75000</recipientZipCode>
<skybillNumber>8VFGF134342F</skybillNumber>
</return>
</ns1:trackResponse>
</soap:Body>
</soap:Envelope> |
Et donc, je dois charger de cette page php le simple code XML.
Code:
1 2 3 4 5 6 7 8 9
|
$soap_response = "http://siteweb?acc=AAAAAA&password=AAAAAAA&Numb=8VFGF134342F";
$xml = simplexml_load_string($soap_response, NULL, TRUE);
$xml->registerXPathNamespace('soap', 'http://schemas.xmlsoap.org/soap/envelope/');
foreach ($xml->xpath('//return') as $item)
{
print_r($item);
} |
J'ai donc plusieurs erreurs :
Citation:
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in /Applications/WAMP/htdocs/project/index.php on line 29
Warning: simplexml_load_string():
http://siteweb? in /Applications/WAMP/htdocs/project/index.php on line 29
Warning: simplexml_load_string(): ^ in /Applications/WAMP/htdocs/laposte/index.php on line 29
Warning: Invalid argument supplied for foreach() in /Applications/WAMP/htdocs/project/index.php on line 31
Donc le format XML me semble correcte, c'est une API utilisé par d'autre personne, que je ne gère absolument pas, mais je n'arrive pas à récupérer le contenu du XML sur mon site web.
Si vous aviez une solution.
Merci d'avance !