mirror of
https://github.com/librespeed/speedtest.git
synced 2024-05-10 18:54:52 +00:00
You can now use ipinfo.io access token
This commit is contained in:
10
getIP.php
10
getIP.php
@@ -65,12 +65,16 @@ function distance($latitudeFrom, $longitudeFrom, $latitudeTo, $longitudeTo) {
|
||||
$dist = sin($latitudeFrom * $rad) * sin($latitudeTo * $rad) + cos($latitudeFrom * $rad) * cos($latitudeTo * $rad) * cos($theta * $rad);
|
||||
return acos($dist) / $rad * 60 * 1.853;
|
||||
}
|
||||
|
||||
function getIpInfoTokenString(){
|
||||
require "getIP_ipInfo_apikey.php";
|
||||
if(empty($IPINFO_APIKEY)) return "";
|
||||
return "?token=".$IPINFO_APIKEY;
|
||||
}
|
||||
if (isset($_GET["isp"])) {
|
||||
$isp = "";
|
||||
$rawIspInfo=null;
|
||||
try {
|
||||
$json = file_get_contents("https://ipinfo.io/" . $ip . "/json");
|
||||
$json = file_get_contents("https://ipinfo.io/" . $ip . "/json".getIpInfoTokenString());
|
||||
$details = json_decode($json, true);
|
||||
$rawIspInfo=$details;
|
||||
if (array_key_exists("org", $details)){
|
||||
@@ -94,7 +98,7 @@ if (isset($_GET["isp"])) {
|
||||
if(file_exists($locFile)){
|
||||
require $locFile;
|
||||
}else{
|
||||
$json = file_get_contents("https://ipinfo.io/json");
|
||||
$json = file_get_contents("https://ipinfo.io/json".getIpInfoTokenString());
|
||||
$details = json_decode($json, true);
|
||||
if (array_key_exists("loc", $details)){
|
||||
$serverLoc = $details["loc"];
|
||||
|
||||
Reference in New Issue
Block a user