Get information about your IP and connection.
- Apache (for web server) or webhosting
- PHP (I'm using v8.1)
Make PHP file. Just create *.php file. Index.php is typical name in this case.
Paste this code
<?php
$protocol = $_SERVER['SERVER_PROTOCOL'];
$ip = $_SERVER['REMOTE_ADDR'];
$port = $_SERVER['REMOTE_PORT'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo('IP Address: '."".$ip ."\n");
echo("<br>");
echo('Hostname: '."".$hostname ."\n");
echo("<br>");
echo('Port Number: '."".$port ."\n");
echo("<br>");
echo('User Agent: '."".$agent ."\n");
echo("<br>");
echo('Protocol type: '."".$protocol ."\n");
echo("<br>");
$details = json_decode(file_get_contents("http://ipinfo.io/{$ip}"));
echo ('Country: '."".$details->country ."\n");
?>
Run it with apache or on hosting, visit it with your browser and enjoy!