GET google location

$address = urlencode(trim($street).'+'.trim($plz).'+'.trim($ort));
$url = "http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false&region=Germany";
$json = json_decode($file_get_contents($url));
$lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};