fix file_get_contents in helper
This commit is contained in:
parent
c1a7615b5f
commit
5a98d128bc
@ -176,9 +176,22 @@ class Helper {
|
||||
|
||||
return $ip;
|
||||
}
|
||||
|
||||
public static function url_get_contents ($Url) {
|
||||
if (!function_exists('curl_init')){
|
||||
die('CURL is not installed!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $Url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $output;
|
||||
}
|
||||
|
||||
public static function getGeoIp() {
|
||||
$ip = Helper::getRealUserIp ();
|
||||
$details = json_decode ( file_get_contents ( "http://ipinfo.io/{$ip}/json" ) );
|
||||
$details = json_decode ( Helper::url_get_contents( "http://ipinfo.io/{$ip}/json" ) );
|
||||
return $details;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user