Add more data sources to ip-info/index.php
This commit is contained in:
parent
8fc9a92f89
commit
ff85cf4091
|
@ -23,8 +23,19 @@
|
||||||
$client_ip = $_SERVER['REMOTE_ADDR'];
|
$client_ip = $_SERVER['REMOTE_ADDR'];
|
||||||
$client_hostname = gethostbyaddr($_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>IP Address: $client_ip</p>";
|
||||||
echo "<p>Hostname: $client_hostname</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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue