Skip to content

Instantly share code, notes, and snippets.

@andi34
Created September 6, 2021 19:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andi34/1463916b84eecc80d801495c033c87c3 to your computer and use it in GitHub Desktop.
Save andi34/1463916b84eecc80d801495c033c87c3 to your computer and use it in GitHub Desktop.
<?php
require_once '../lib/config.php';
if ($os == 'linux') {
$get_ip = shell_exec('hostname -I | cut -d " " -f 1');
if (!$get_ip) {
$IP = $_SERVER['HTTP_HOST'];
} else {
$IP = $get_ip;
}
} else {
$IP = 'can not detect on Windows!';
}
echo "Your IP: $IP";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment