Google Maps for Plugin JSON
-
Hello,
I need some help how to get the answers from them google API into PHP.
{ "results" : [ { "address_components" : [ { "long_name" : "51061", "short_name" : "51061", "types" : [ "postal_code" ] }, { "long_name" : "K?ln", "short_name" : "K?ln", "types" : [ "locality", "political" ] }, { "long_name" : "K?ln", "short_name" : "K", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Nordrhein-Westfalen", "short_name" : "NRW", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "Deutschland", "short_name" : "DE", "types" : [ "country", "political" ] } ], "formatted_address" : "51061 K?ln, Deutschland", "geometry" : { "bounds" : { "northeast" : { "lat" : 51.0225911, "lng" : 7.0548179 }, "southwest" : { "lat" : 50.973904, "lng" : 6.962263 } }, "location" : { "lat" : 50.9958446, "lng" : 7.004471499999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 51.0225911, "lng" : 7.0548179 }, "southwest" : { "lat" : 50.973904, "lng" : 6.962263 } } }, "place_id" : "ChIJZbBmcTMvv0cRcJElq_9gJxw", "types" : [ "postal_code" ] } ], "status" : "OK" }
For the Geodata and the formated address it is works fine.
$_lat = $_coordinates->results[0]->geometry->location->lat; $_lng = $_coordinates->results[0]->geometry->location->lng; $_formAddress = $_coordinates->results[0]->formatted_address;
But how do I get the
administrative_area_level_1
I tried
$_theLand = $_coordinates->results[0]->address_components[0]->administrative_area_level_1;
but nothing returns only NULL.
Any suggestion?
Denis
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Google Maps for Plugin JSON’ is closed to new replies.