How to get Client IP Address in PHP
PHP Extract client information from the web server and stored in $_SERVER array. We can get the client IP address from the $_SERVER array by using “REMOTE_ADDR” argument.
$client_ip = $_SERVER["REMOTE_ADDR"];
We can write a simple function which will print the client IP Address.
$client_ipaddress = $_SERVER["REMOTE_ADDR"];
echo "IP Address of the Client is : ".$client_ipaddress;