Código:
Yo necesito parsear el PostalCodeNumber, pero no puedo entrar al nodo, esto es lo que estoy usando, pero sin exito:<kml xmlns="http://earth.google.com/kml/2.0"> <Response> <name>1600 amphitheatre mountain view ca</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark> <address> 1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA </address> <AddressDetails Accuracy="8"> <Country> <CountryNameCode>US</CountryNameCode> <AdministrativeArea> <AdministrativeAreaName>CA</AdministrativeAreaName> <SubAdministrativeArea> <SubAdministrativeAreaName>Santa Clara</SubAdministrativeAreaName> <Locality> <LocalityName>Mountain View</LocalityName> <Thoroughfare> <ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName> </Thoroughfare> <PostalCode> <PostalCodeNumber>94043</PostalCodeNumber> </PostalCode> </Locality> </SubAdministrativeArea> </AdministrativeArea> </Country> </AddressDetails> <Point> <coordinates>-122.083739,37.423021,0</coordinates> </Point> </Placemark> </Response> </kml>
Código:
faltan un par de }, pero la idea es que me puedan dar una mano con como sacarlo.$xml = simplexml_load_file($request_url) or die("url not loading"); $status = $xml->Response->Status->code; if (strcmp($status, "200") == 0) { // Successful geocode $geocode_pending = false; // $coordinates = $xml->Response->Placemark->address; $postcode = $xml->Response->Placemark->AddressDetails->PostslCode; // echo $coordinates; echo $postcode;
Mil gracias!!!