From c327e11cf59a19eaefee7afe7e56b88e8df890f9 Mon Sep 17 00:00:00 2001 From: tyronewyatt Date: Fri, 3 Apr 2020 09:25:57 +1100 Subject: [PATCH 1/3] Create getIP_ipinfo_httpproxy.php --- backend/getIP_ipinfo_httpproxy.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 backend/getIP_ipinfo_httpproxy.php 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); +?> From 196998735a844357622fd2839bbb71d30b3a8091 Mon Sep 17 00:00:00 2001 From: tyronewyatt Date: Fri, 3 Apr 2020 09:27:33 +1100 Subject: [PATCH 2/3] Enable IPINFO_HTTPPROXY --- backend/getIP.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/getIP.php b/backend/getIP.php index 7d7c40053..fe3f3d63c 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"]; From 27c34707ab1c5bc785c55b2af3cf0834e031466b Mon Sep 17 00:00:00 2001 From: tyronewyatt Date: Fri, 3 Apr 2020 15:14:00 +1100 Subject: [PATCH 3/3] remove double close bracket typo --- backend/getIP.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/getIP.php b/backend/getIP.php index fe3f3d63c..141c08e72 100644 --- a/backend/getIP.php +++ b/backend/getIP.php @@ -87,7 +87,7 @@ function getIpInfoTokenString(){ $isp = ""; $rawIspInfo=null; try { - $json = file_get_contents("https://ipinfo.io/" . $ip . "/json".getIpInfoTokenString(), False, $IPINFO_HTTPPROXY);); + $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)){ @@ -111,7 +111,7 @@ function getIpInfoTokenString(){ if(file_exists($locFile)){ require $locFile; }else{ - $json = file_get_contents("https://ipinfo.io/json".getIpInfoTokenString(), False, $IPINFO_HTTPPROXY);); + $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"];