1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
$xml = '<?xml version="1.0" encoding="UTF-8"?> <XLS xmlns:xls="http://www.opengis.net/xls" xmlns:gml="http://www.opengis.net/gml" xmlns="http://www.opengis.net/xls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:schemaLocation="http://www.opengis.net/xls
http://schemas.opengis.net/ols/1.2/olsAll.xsd"><RequestHeader srsName="epsg:4326"/><Request requestID="1" version="1.2" methodName="LocationUtilityService" maximumResponses=""><GeocodeRequest returnFreeForm="false"><Address countryCode="StreetAddress"><freeFormAddress>1 rue Marconi 57000 Metz</freeFormAddress></Address></GeocodeRequest></Request></XLS>';
// Envoi du XML via CURL / POST en text/xml.
$ch = curl_init('http://gpp3-wxs.ign.fr/' . $api_key . '/geoportail/ols?');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', 'referer: http://xxxxxxxxxxxxxxxx/test_ols_ign.php'));
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, htmlspecialchars($xml, ENT_QUOTES));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_REFERER, 'http://xxxxxxxxxxxxxxxx/test_ols_ign.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ch_result = curl_exec($ch);
curl_close($ch);
// Print CURL result
echo $ch_result; |
Partager