mirror of
https://github.com/twisterarmy/twister-analytics-crawler.git
synced 2025-01-30 16:34:18 +00:00
26 lines
575 B
PHP
26 lines
575 B
PHP
<?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;
|
|
}
|
|
}
|