You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
575 B
25 lines
575 B
<?php |
|
|
|
class CurlGeoPlugin extends Curl { |
|
|
|
public function getLocation($ip) { |
|
|
|
$this->prepare('json.gp?ip=' . $ip, 'GET'); |
|
|
|
if ($response = $this->execute()) { |
|
|
|
switch (false) { |
|
case isset($response['geoplugin_city']): |
|
case isset($response['geoplugin_countryCode']): |
|
case isset($response['geoplugin_latitude']): |
|
case isset($response['geoplugin_longitude']): |
|
|
|
return false; |
|
} |
|
|
|
return $response; |
|
} |
|
|
|
return false; |
|
} |
|
}
|
|
|