Skip to content

Instantly share code, notes, and snippets.

@renekreijveld
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renekreijveld/e6e6be6543e15b7f1399 to your computer and use it in GitHub Desktop.
Save renekreijveld/e6e6be6543e15b7f1399 to your computer and use it in GitHub Desktop.
Search lat/lom for address
$zoekadres = $l_adres." ".$l_postcode." ".$l_plaats." ".$l_land;
$zoekadres = urlencode($zoekadres);
$url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address={$zoekadres}";
$resp_json = file_get_contents($url);
$resp = json_decode($resp_json, true);
if($resp['status']=='OK') {
$lat = $resp['results'][0]['geometry']['location']['lat'];
$lng = $resp['results'][0]['geometry']['location']['lng'];
} else {
$lat = "";
$lng = "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment