Snippets tagged "googlemap php" Snippets tagged "googlemap php"

Passer outre le "allow_url_fopen et allow_url_include" a Off

Qui n'a jamais eu un Warning de type : "filegetcontents() function.file-get-contents: URL file-access is disabled in the server configuration in % on line %" sur un hebergement mutualisé ?

la solution et d'utiliser lynx en ligne de commande pour attaquer une url, on utilisera la fonction exec(), exemple avec l'api GoogleMaps

<?php
 
define('GOOGLE_API_KEY', 'your_google_api_key_here');
$wsurl = 'http://maps.google.com/maps/geo?q=%s&output=csv&key=%s';
$location = 'Paris, France';
 
$data = explode(',', exec('lynx --dump \''.sprintf($wsurl, urlencode($location), GOOGLE_API_KEY).'\''));
/*** Au lieu de ***/
$data = explode(',', file_get_contents(sprintf($wsurl, urlencode($location), GOOGLE_API_KEY)));
 
 
$coord = 200 === (int)$data[0] ? array((float)$data[2], (float)$data[3]) : null;
var_dump($coord);
?>
by EL BROUDI ALI on 2008-05-13, tagged allowurlfopen  filegetcontents  googlemap  php