How to geocode an address using Google and php

Google has some amazing services, one of my favourites would have to be the ability to geocode an address and get not only the lat/long but a clean, well formatted address back. 

How you say... Easy!

Get yourself an api key from here:

use the following php code:

$key //your api key 
$address //address to geocode 
$url = ''.urlencode($address).'&output=json&sensor=false&key='.$key; 
$data = file_get_contents($url); 
$loc = json_decode($data); 
$lat = $loc->Placemark[0]->Point->coordinates[1]; 
$long = $loc->Placemark[0]->Point->coordinates[0]; 

Thanks Google!

Jeremy Graham

Crafts beautiful looking things with bits and bytes