Welcome Guest, Not a member yet? Register   Sign In
HTTP request (Google Maps Geocoding)
#1

[eluser]RS71[/eluser]
Hello

How can I use Google's Geocoding service to retrieve some lat & lng information and pass it php/CI?

Example url:

http://maps.google.com/maps/geo?q=new+yo...ur_api_key

Also, how would php deal with timeouts or the possibility of the service being down?

Thanks in advance
#2

[eluser]rossmurphy[/eluser]
Is xml returned with this call? If so you could use PHP's http_build_query() function then parse the response xml using php's simpleXML..

Code:
$url = 'http://maps.google.com/maps/geo?';

$fields = array('q' => $q,
                'output' => $output,
                'sensor' => $sensor,
                'key' => $key
);

$query_string = $url . http_build_query($fields, '', '&');




Theme © iAndrew 2016 - Forum software by © MyBB