1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| <?php
$data = array(
'output' => 'json',
'xls' => <<<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/>
<Request requestID="" version="1.2" methodName="LocationUtilityService" maximumResponses="10">
<ReverseGeocodeRequest>
<Position>
<gml:Point>
[1]
</gml:Point>
</Position>
<ReverseGeocodePreference>StreetAddress</ReverseGeocodePreference>
</ReverseGeocodeRequest>
</Request>
</XLS>
XML
);
header('Content-Type: text/xml; charset=utf-8');
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, '[URL RELATIVE A MA CLE]');
curl_setopt($ch, CURLOPT_URL,
'http://wxs.ign.fr/[MA CLE]/geoportail/ols?'.
http_build_query($data)
);
ob_start();
curl_exec($ch);
$json = ob_get_clean();
echo json_decode($json)->xml; |
Partager