<?php
$header[] = "Accept: text/xml,application/xml,application/json,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$header[] = "Cache-Control: max-age=0";
$header[] = "Connection: keep-alive";
$header[] = "Keep-Alive: 300";
$header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7";
$header[] = "Accept-Language: en-us,en;q=0.5";
$referer = 'referer';
$opts = array('http'=>array(
'method'=>"GET",
'header'=>implode('\r\n',$header)."\r\n".
"Referer: $referer\r\n",
'user_agent'=> "Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.2) Gecko/2008092313 Ubuntu/9.25 (jaunty) Firefox/3.8"
));
$context = stream_context_create($opts);
// Accès à un fichier HTTP avec les entêtes HTTP indiqués ci-dessus
$response = file_get_contents('http://wxs.ign.fr/clé/alti/rest/elevation.json?lon=1.104943&lat=45.946521&zonly=true&callback=traiteResult&output=json', false, $context);
Partager