homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / XML Development
Forum Library, Charter, Moderators: httpwebwitch

XML Development Forum

Help with Google Maps xml output

 7:03 am on Jul 15, 2007 (gmt 0)


I use PHP 5.0

I am trying to read the PostalCodeNumber node from the Google Maps xml output below:

$xmlstr = "<xml>
<name>1600 amphitheatre mtn view ca</name>
1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA
<AddressDetails Accuracy="8">
<SubAdministrativeAreaName>Santa Clara</SubAdministrativeAreaName>
<LocalityName>Mountain View</LocalityName>
<ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName>

$xml = new SimpleXMLElement($xmlstr);
$zipcode = $xml->AddressDetails->PostalCode->PostalCodeNumber;

for some reason it's not working. anyone got any ideas?

Thank you in advance for your help.



 8:25 am on Jul 15, 2007 (gmt 0)

maybe something like this will work:

$zipcode = $xml->AddressDetails->Country->AdministrativeArea->SubAdministrativeArea->Locality->


 9:56 am on Jul 15, 2007 (gmt 0)

the example of the xml output that is on the Google Maps API Documentation page is not correct.

I checked the xml output that I get back from Google and it does not contain the node "SubAdministrativeArea"

this gave me what i wanted $xml->Response->Placemark->AddressDetails->Country->AdministrativeArea->Locality->PostalCode->PostalCodeNumber

thank you for your help.


 11:08 pm on Jul 15, 2007 (gmt 0)

and i just noticed i had missed the "Response->Placemark->" in my suggested solution based on their example...

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / XML Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved