I need to display the address of the server by which it can be identified in LAN.
I tried using
echo $_SERVER["SERVER_ADDR"]; but this just returns 127.0.0.1 instead of 192.168.xx.xx.
How do i get the second one without the access to WWW?
I need to display the address of the server by which it can be identified in LAN.
I tried using
echo $_SERVER["SERVER_ADDR"]; but this just returns 127.0.0.1 instead of 192.168.xx.xx.
How do i get the second one without the access to WWW?
Hope this will help,
function getLanIP(){ exec("ipconfig /all", $output); foreach($output as $line){ if (preg_match("/(.*)IPv4 Address(.*)/", $line)){ $ip = $line; $ip = str_replace("IPv4 Address. . . . . . . . . . . :","",$ip); $ip = str_replace("(Preferred)","",$ip); } } return $ip; } OR something like,
$ip = getLanIP(); echo $ip; <?php function getLocalIp(){ return gethostbyname(trim(`hostname`)); } echo getLocalIp(); ?>