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
|
function GEOPORTAIL_GET($urlBase,$DEBUG="NON")
{
// $urlBase contient https://wxs.ign.fr/calcul/geoportail/geocodage/rest/0.1/reverse?index=parcel&searchgeom=%7B%22type%22:%22Polygon%22,%22coordinates%22:%5B[[1.1120170258,45.9520385335],[1.0992262488,45.952038029],[1.0992280002,45.9431451099],[1.1120167253,45.9431456143],[1.1120170258,45.9520385335]]]}&lon=1.105622&lat=45.947592&limit=1
$url=$urlBase;
if ($DEBUG=="OUI")
{
echo "GEOPORTAIL_GET=".$urlBase."<hr>";
}
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_REFERER=>'https://wnat.fr',
CURLOPT_URL => $url,
CURLOPT_USERAGENT => 'Codular Sample cURL Request'
));
$json = curl_exec($curl);
if (curl_errno($curl)) {
echo curl_error($curl);
}
if ($DEBUG=="OUI")
{
echo "TIME 2 ".date("h:i:s").'<br>'.$url.'<hr>********'.$json.'<hr>';
}
return($json); |
Partager