Sometimes you need to get the client side the IP address to implement some features in web application using PHP programming language. In this tutorial, we will share 2 line PHP code to get the client IP address.
Copy the below PHP code and use it inside your PHP script to print the IP address.
* get the client IP address in PHP
$ipaddress = $_SERVER['REMOTE_ADDR']
Echo "Your IP Address is " . $ipaddress;
Your IP is 220.127.116.11
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.