ÿØÿà JFIF ` ` ÿþxØ
| Server IP : 109.234.164.53 / Your IP : 216.73.216.110 Web Server : Apache System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64 User : computer3 ( 1098) PHP Version : 7.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/computer3/fermegarat.com/includes/class/ |
Upload File : |
<?php
class IPAPI {
static $fields = 65535;
static $use_xcache = false;
static $api = "http://ip-api.com/php/";
public $status, $country, $countryCode, $region, $regionName, $city, $zip, $lat, $lon, $timezone, $isp, $org, $as, $reverse, $query, $message;
public static function query($q) {
$data = self::communicate($q);
// $result = new self;
foreach($data as $key => $val) {
$result->$key = $val;
}
return $result;
}
private function communicate($q) {
$q_hash = md5('ipapi'.$q);
if(self::$use_xcache && xcache_isset($q_hash)) {
return xcache_get($q_hash);
}
if(is_callable('curl_init')) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, self::$api.$q.'?fields='.self::$fields);
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_TIMEOUT, 30);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$result_array = unserialize(curl_exec($c));
curl_close($c);
} else {
$result_array = unserialize(file_get_contents(self::$api.$q.'?fields='.self::$fields));
}
if(self::$use_xcache) {
xcache_set($q_hash, $result_array, 86400);
}
return $result_array;
}
}
?>