Hello!
Is there something new I missed? After three months, today I opened up a project of mine I was working on but the script I’m using for geocoding is not working anymore (it did back in october).
$city = "Szeged";
$street = "Vitéz u. 28";
$address = $city.'+'.$street;
$geo_address = str_replace(" ", "+", $address);
$json = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=$geo_address&key=AIzaSyAAQPA..........blablabla...............WzlPFmR6I");
$json = json_decode($json);
$lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$lng = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
It returns the following errors:
Notice: Undefined offset: 0 in C:\xampp2\htdocs\prand\proba.php on line 10
Notice: Trying to get property ‘geometry’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 10
Notice: Trying to get property ‘location’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 10
Notice: Trying to get property ‘lat’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 10
Notice: Undefined offset: 0 in C:\xampp2\htdocs\prand\proba.php on line 11
Notice: Trying to get property ‘geometry’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 11
Notice: Trying to get property ‘location’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 11
Notice: Trying to get property ‘lng’ of non-object in C:\xampp2\htdocs\prand\proba.php on line 11