diff --git a/common/components/Helper.php b/common/components/Helper.php index 949afdf..607aa37 100644 --- a/common/components/Helper.php +++ b/common/components/Helper.php @@ -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; } } \ No newline at end of file