note 106443 deleted from simplexmlelement.xpath by danbrown

From: Date: Tue, 15 Nov 2011 16:39:53 +0000
Subject: note 106443 deleted from simplexmlelement.xpath by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-184488@lists.php.net to get a copy of this message
Note Submitter: tnovak at modernagllc dot com ---- After hours of not finding anything of the sort. I wrote the following. It will pull the zip code from google geocoding API using the lon and lat. It searches the google xml and returns the first zip code found. <?php $xml = simplexml_load_file('http://maps.googleapis.com/maps/api/geocode/xml?latlng=' . $userlon . ',' . $userlat . '&sensor=true'); $address_component = $xml->xpath('//address_component[type="postal_code"]'); $userzip = ($address_component[0]->long_name); ?>

« previous php.notes (#184488) next »