Ok, fangen wir anders an. Mein Querry an die Google API sieht wie folgend aus:
http://maps.googleapis.com/maps/api/geocode/xml?address=ackerstr.+mitte,+berlin,+10115,+deutschland&sensor=false&language=de
Ich nutze nun simplexml um ihn zu öffnen und erhalte folgenden Datensatz:
SimpleXMLElement Object
(
[status] => OK
[result] => SimpleXMLElement Object
(
[type] => route
[formatted_address] => Ackerstraße, 10115 Berlin, Deutschland
[address_component] => Array
(
[0] => SimpleXMLElement Object
(
[long_name] => Ackerstraße
[short_name] => Ackerstraße
[type] => route
)
[1] => SimpleXMLElement Object
(
[long_name] => Mitte
[short_name] => Mitte
[type] => Array
(
[0] => sublocality
[1] => political
)
)
[2] => SimpleXMLElement Object
(
[long_name] => Berlin
[short_name] => Berlin
[type] => Array
(
[0] => locality
[1] => political
)
)
[3] => SimpleXMLElement Object
(
[long_name] => Berlin
[short_name] => Berlin
[type] => Array
(
[0] => administrative_area_level_1
[1] => political
)
)
[4] => SimpleXMLElement Object
(
[long_name] => Deutschland
[short_name] => DE
[type] => Array
(
[0] => country
[1] => political
)
)
[5] => SimpleXMLElement Object
(
[long_name] => 10115
[short_name] => 10115
[type] => postal_code
)
)
[geometry] => SimpleXMLElement Object
(
[location] => SimpleXMLElement Object
(
[lat] => 52.5318480
[lng] => 13.3961610
)
[location_type] => GEOMETRIC_CENTER
[viewport] => SimpleXMLElement Object
(
[southwest] => SimpleXMLElement Object
(
[lat] => 52.5289240
[lng] => 13.3913010
)
[northeast] => SimpleXMLElement Object
(
[lat] => 52.5350052
[lng] => 13.3976550
)
)
[bounds] => SimpleXMLElement Object
(
[southwest] => SimpleXMLElement Object
(
[lat] => 52.5289240
[lng] => 13.3913010
)
[northeast] => SimpleXMLElement Object
(
[lat] => 52.5350052
[lng] => 13.3976550
)
)
)
[partial_match] => true
)
)
Wie komme ich nun an $xml->result->address_component->1->type->0 ?