Skip to content
This repository has been archived by the owner on Jul 5, 2019. It is now read-only.

Commit

Permalink
Some results do not include city and region
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeholder committed Mar 26, 2015
1 parent 5db0656 commit 1977787
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 2 additions & 1 deletion geo/config.php
Expand Up @@ -3,6 +3,7 @@
return array(
// This is the IP address used if in devMode or visiting your site
// from the local computer to the server.
"defaultIp"=>"190.93.246.7",
"defaultIp"=>"190.93.246.7", // Costa Rica
// "defaultIp"=>"92.111.6.18", Netherland no city or region
"cacheTime"=>"43200" //seconds
);
15 changes: 13 additions & 2 deletions geo/services/Geo_LocationService.php
Expand Up @@ -76,14 +76,25 @@ private function getNekudoData($ip){

$data = json_decode($response->getBody());

if(isset($data->subdivisions[0])){
$regionName = $data->subdivisions[0]->names->en;
}else{
$regionName = "";
}

if(isset($data->city)){
$city = $data->city->names->en;
}else{
$city = "";
}

$data = array(
"ip"=>$data->traits->ip_address,
"country_code"=>$data->country->iso_code,
"country_name"=>$data->country->names->en,
"region_name"=>$data->subdivisions[0]->names->en,
"region_name"=>$regionName,
// Yes i know, i am not getting postcode etc yet.
"city"=>$data->city->names->en,
"city"=>$city,
"latitude"=>$data->location->latitude,
"longitude"=>$data->location->longitude,
"cached"=>false
Expand Down

0 comments on commit 1977787

Please sign in to comment.