Skip to content

Instantly share code, notes, and snippets.

@jhtan
Created June 7, 2014 19:43
Show Gist options
  • Save jhtan/1baf5d8e9b9a94fb9f62 to your computer and use it in GitHub Desktop.
Save jhtan/1baf5d8e9b9a94fb9f62 to your computer and use it in GitHub Desktop.
latitude&longitude2
<?php
/**
* Created by PhpStorm.
* User: jhtan
* Date: 6/7/14
* Time: 1:13 PM
*/
$address = $_GET['address'] . ' Nuestra Señora de La Paz, Bolivia';
//$url = "http://maps.google.com/maps/api/geocode/json?address=" . urlencode($address) . "&components=country:BO|locality:" . urlencode("Nuestra Señora de La Paz") . "";
$url = "http://maps.google.com/maps/api/geocode/json?address=" . urlencode($address) . "&components=country:BO";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
curl_close($ch);
//$response_a = json_decode($response);
//echo $lat = $response_a->results[0]->geometry->location->lat;
//echo "<br />";
//echo $long = $response_a->results[0]->geometry->location->lng;
echo $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment