In this post we will learn how to use php to get the visitor’s IP address in a webpage.
This code also helps Network or system admin to know from which IP he is using currently.
For eg. your company have 2 public IP from different ISP and both are in failover. The companies network is NAT with single public IP. Means if one ISP internet goes down ,it will failover to second ISP internet connection.
You do not have access of network devices. Suddenly the internet disconnected for a few seconds,now through website you have to determine which ISP network is running.
For this purpose sometimes we use some website like whatismyip.org which is famous one. Instead of using these website you can create your own. Now it is up to you ,how far you can use this method.
The below given php code will help you to show the visitor’s IP address in Dashbaord.
Create a file with .php extension and paste the given below code
<?php echo "Your IP Address:"; echo $_SERVER['REMOTE_ADDR']; ?>