diff --git a/backend/getIP.php b/backend/getIP.php index 7d7c40053..141c08e72 100644 --- a/backend/getIP.php +++ b/backend/getIP.php @@ -79,11 +79,15 @@ function getIpInfoTokenString(){ if(empty($IPINFO_APIKEY)) return ""; return "?token=".$IPINFO_APIKEY; } +$httpproxyFile="getIP_ipInfo_httpproxy.php"; +if (!file_exists($httpproxyFile)) return ""; +require $httpproxyFile; +if (empty($IPINFO_PROXYADDRESS)) $IPINFO_HTTPPROXY = $NULL; if (isset($_GET["isp"])) { $isp = ""; $rawIspInfo=null; try { - $json = file_get_contents("https://ipinfo.io/" . $ip . "/json".getIpInfoTokenString()); + $json = file_get_contents("https://ipinfo.io/" . $ip . "/json".getIpInfoTokenString(), False, $IPINFO_HTTPPROXY); $details = json_decode($json, true); $rawIspInfo=$details; if (array_key_exists("org", $details)){ @@ -107,7 +111,7 @@ function getIpInfoTokenString(){ if(file_exists($locFile)){ require $locFile; }else{ - $json = file_get_contents("https://ipinfo.io/json".getIpInfoTokenString()); + $json = file_get_contents("https://ipinfo.io/json".getIpInfoTokenString(), False, $IPINFO_HTTPPROXY); $details = json_decode($json, true); if (array_key_exists("loc", $details)){ $serverLoc = $details["loc"]; diff --git a/backend/getIP_ipinfo_httpproxy.php b/backend/getIP_ipinfo_httpproxy.php new file mode 100644 index 000000000..8c9265e67 --- /dev/null +++ b/backend/getIP_ipinfo_httpproxy.php @@ -0,0 +1,16 @@ +array( + "verify_peer"=>false, + "verify_peer_name"=>false, + ), + 'http' => array( + 'proxy' => 'tcp://'.$IPINFO_PROXYADDRESS.':'.$IPINFO_PROXYPORT, + 'request_fulluri' => true, + ), +); +$IPINFO_HTTPPROXY= stream_context_create($streamContext); +?>