Add Google Geocoding example

This commit is contained in:
Zach Borboa
2014-08-29 19:54:55 -07:00
parent f357bf77f7
commit 9fb14c9887
+19
View File
@@ -0,0 +1,19 @@
<?php
require '../src/Curl/Curl.php';
use \Curl\Curl;
$address = 'Paris, France';
$curl = new Curl();
$curl->get('http://maps.googleapis.com/maps/api/geocode/json', array(
'address' => $address,
));
if ($curl->response->status === 'OK') {
$result = $curl->response->results['0'];
echo
$result->formatted_address . ' is located at ' .
'latitude ' . $result->geometry->location->lat . ' and ' .
'longitude ' . $result->geometry->location->lng . '.';
}