How to create php script to show lan ip address?

Asked By 70 points N/A Posted on -
qa-featured

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.

SHARE
Best Answer by JOY Schilling
Best Answer
Best Answer
Answered By 5 points N/A #181700

How to create php script to show lan ip address?

qa-featured
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
Answered By 0 points N/A #181701

How to create php script to show lan ip address?

qa-featured

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.

Related Questions