Get local IP address in PHP
php get ip address
$clientIPAddress=$_SERVER['REMOTE_ADDR'];
The simplest way to collect the visitor IP address in PHP is the REMOTE_ADDR. Pass the 'REMOTE_ADDR' in PHP $_SERVER variable. It will return the IP address of the visitor who is currently viewing the webpage.