Add more data sources to ip-info/index.php

This commit is contained in:
Primrose 2022-11-20 12:52:15 -05:00
parent 8fc9a92f89
commit ff85cf4091
1 changed files with 11 additions and 0 deletions

View File

@ -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 "<p>IP Address: $client_ip</p>";
echo "<p>Hostname: $client_hostname</p>";
echo "<p>ISP: " . $json->org, "</p>";
echo "<p>City: " . $json->city, "</p>";
echo "<p>Region: " . $json->region, "</p>";
echo "<p>Country: " . $json->country, "</p>";
echo "<p>Coordinates: " . $json->loc, "</p>";
echo "<p>Postal Code: " . $json->postal, "</p>";
echo "<p>Timezone: " . $json->timezone, "</p>";
?>
</div>
</body>