From 5a98d128bcb83959f071baa646cef7b4d36afee2 Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Fri, 8 Jan 2016 23:22:06 +0100 Subject: [PATCH] fix file_get_contents in helper --- common/components/Helper.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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