Skip to content

Instantly share code, notes, and snippets.

@bytefade
Created October 23, 2014 12:29
Show Gist options
  • Save bytefade/22ec83cbab68ccdef55c to your computer and use it in GitHub Desktop.
Save bytefade/22ec83cbab68ccdef55c to your computer and use it in GitHub Desktop.
Forma rápida e mediocre de pegar latitude longitude
<?php
$address = 'avenida+gustavo+paiva,maceio,alagoas,brasil';
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false');
$output= json_decode($geocode);
echo $lat = $output->results[0]->geometry->location->lat;
echo $long = $output->results[0]->geometry->location->lng;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment