Hello fellows,
How to create PHP script to show LAN ip address? This is very important when it comes to checking some connections using local area networking ip addresses. I am handling 20 computers and I am testing a website that can detect or may show LAN ip addresses. I want some suggestions from you.
Regards,
Kristen James.
How to create php script to show lan ip address?
Hi Kristen
Â
Here is the php script for finding the user's IP address. It is actually much simpler and easy than you might think. and can be done in a single line code.Â
And the code is : Getenv("REMOTE_ADDR")Â
thats it. This code will return the IP address of the person who visiting your website.
Â
Complete php code is:
<?php Â
//Gets the IP addressÂ
$ip = getenv("REMOTE_ADDR") ; Â
Echo "Your IP is " . $ip; Â
?>Â
Â
Copy and paste it to your websites page.Â
Â
Thank You
How to create php script to show lan ip address?
Hi Kristen
Well you can use the following code fragment to get the IP Address of any particular instance.
function getip() {
   print "IP = ".$_SERVER["REMOTE_ADDR"];
}
getip();
This code is actually what we use to get the IP address of a instance/system which accesses a website that has been hosted in a server.
The IP address of any number of systems accessing the network can be found.