Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions backend/getIP.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return here?
The missing file should be handled as if no proxy defined.

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)){
Expand All @@ -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"];
Expand Down
16 changes: 16 additions & 0 deletions backend/getIP_ipinfo_httpproxy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
$IPINFO_PROXYADDRESS=""; // leave proxy address blank for direct
$IPINFO_PROXYPORT="800";

$streamContext = array(
"ssl"=>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);
?>