From ff85cf409165e58748d565844c2078bdb115cd67 Mon Sep 17 00:00:00 2001 From: Primrose Date: Sun, 20 Nov 2022 12:52:15 -0500 Subject: [PATCH] Add more data sources to ip-info/index.php --- ip-info/index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ip-info/index.php b/ip-info/index.php index cd8bba7..c2608c5 100644 --- a/ip-info/index.php +++ b/ip-info/index.php @@ -23,8 +23,19 @@ $client_ip = $_SERVER['REMOTE_ADDR']; $client_hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); + $token = "your_token_here"; + $request_url = file_get_contents("https://ipinfo.io/" . $client_ip . "/json/?token=" . $token); + $json = json_decode($request_url); + echo "

IP Address: $client_ip

"; echo "

Hostname: $client_hostname

"; + echo "

ISP: " . $json->org, "

"; + echo "

City: " . $json->city, "

"; + echo "

Region: " . $json->region, "

"; + echo "

Country: " . $json->country, "

"; + echo "

Coordinates: " . $json->loc, "

"; + echo "

Postal Code: " . $json->postal, "

"; + echo "

Timezone: " . $json->timezone, "

"; ?>