function locate_country ($country
{
$data = file_get_contents"http://maps.google.com/maps/geo?output=csv&q="urlencode$country));
$arr = explode",", $data);
if (count$arr)>=4) {
if ($arr[0]==200) {
return array'latitude'=>$arr[2], 'longitude'=>$arr[3]);
} else {
throw new Exception'Country could not be geocoded');
}
} else {
throw new Exception'Country could not be geocoded');
}
}
eXorithm – Execute Algorithm: View / Run Algorithm locate_country
