I have read a few Q&As on here and additional articles, but cannot get this script to display the relevant values from the JSON return (which are long and lat from this Google Maps call).
<?php
// Address for Google to search
$address = 'London,UK';
// Get the map json data from Google Maps using the $address variable
$googleCall = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $address .'&sensor=false';
$json = file_get_contents($googleCall);
//header("Content-type: application/json");
//echo $json;
echo $json->results->geometry->location->lat;
echo $json->results->geometry->location->lng;
?>
I am sure I am 99% there, just cannot see where the error is.
json_decodeis missing in your code.