I currently use the lines of code below to list the city where I am through latitude and longitude, but with the same coordinates, I want you to also list the cities that are around, for example mileage. It's possible? I researched a lot about this but I did not find a solution.
Here is the code I'm using to pull the current city:
$latitude = htmlspecialchars($_GET["latitude"]);
$longitude = htmlspecialchars($_GET["longitude"]);
$geocode = file_get_contents('http://maps.googleapis.com/maps/api/geocode/json?latlng='.$latitude.','.$longitude.'&sensor=false');
$resultado = json_decode($geocode);
for($j=0;$j<count($resultado->results[0]->address_components);$j++){
$cn=array($resultado->results[0]->address_components[$j]->types[0]);
if(in_array("locality", $cn))
{
$s = $resultado->results[0]->address_components[$j]->long_name;
}
}
I would appreciate it if you could help me find a solution.