here’s my decoded json output,
object(stdClass)#1 (3) { ["name"]=> string(34) "xxxxxxxxxxxxxxx" ["Status"]=> object(stdClass)#2 (2) { ["code"]=> int(200) ["request"]=> string(7) "geocode" } ["Placemark"]=> array(1) { [0]=> object(stdClass)#3 (5) { ["id"]=> string(2) "p1" ["address"]=> string(32) "xxxxxxxxxxxxxxx, USA" ["AddressDetails"]=> object(stdClass)#4 (2) { ["Accuracy"]=> int(8) ["Country"]=> object(stdClass)#5 (3) { ["AdministrativeArea"]=> object(stdClass)#6 (2) { ["AdministrativeAreaName"]=> string(2) "UT" ["Locality"]=> object(stdClass)#7 (3) { ["LocalityName"]=> string(4) "xxxxxxxxxxxxxxx" ["PostalCode"]=> object(stdClass)#8 (1) { ["PostalCodeNumber"]=> string(5) "xxxxxxxxxxxxxxx" } ["Thoroughfare"]=> object(stdClass)#9 (1) { ["ThoroughfareName"]=> string(7) "xxxxxxxxxxxxxxx" } } } ["CountryName"]=> string(3) "USA" ["CountryNameCode"]=> string(2) "US" } } ["ExtendedData"]=> object(stdClass)#10 (1) { ["LatLonBox"]=> object(stdClass)#11 (4) { ["north"]=> float(xxxxxxxxxxxxxxx) ["south"]=> float(xxxxxxxxxxxxxxx) ["east"]=> float(-111.7018448) ["west"]=> float(xxxxxxxxxxxxxxx) } } ["Point"]=> object(stdClass)#12 (1) { ["coordinates"]=> array(3) { [0]=> float(xxxxxxxxxxxxxxx) [1]=> float(xxxxxxxxxxxxxxx) [2]=> int(0) } } } } }
I can retrieve the zipcode (84058) by using
echo $geo->Placemark[0]->AddressDetails->Country->AdministrativeArea->Locality->PostalCode->PostalCodeNumber;
but how in the world would I retrieve these objects?:
- [“north”]=> float(40.2824822)
- [“east”]=> float(-111.7018448)
- [0]=>float(-111.7032032)
- [1]=> float(40.2811332)
Thanks, i’m new to this.
It’s a lot easy to see if you try running it through a pretty printer: