Skip to content

Instantly share code, notes, and snippets.

@enklenke
enklenke / gist:9f734f58662128080dbb
Created November 23, 2015 19:23 — forked from clnmcgrw/gist:9086505
Google Maps API Geocode Example - PHP/JSON
<?php
// address to map
$map_address = "";
$url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=".urlencode($map_address);
$lat_long = get_object_vars(json_decode(file_get_contents($url)));
// pick out what we need (lat,lng)
$lat_long = $lat_long['results'][0]->geometry->location->lat . "," . $lat_long['results'][0]->geometry->location->lng;