» Snippets » php » How to Get Remote IP Address in PHP
PHP has in built facility to detect remote browser or IP address and other properties. These values are assigned to special variable. In this case, it is assigned to variable called REMOTE_ADDR. You can use any one of the following statement to obtained or read IP address:
function getRemoteIPAddress() {
$ip = $_SERVER['REMOTE_ADDR'];
return $ip;
}
echo getRemoteIPAddress(); // print your ip address.
Enjoy!
Publish your snippets with us & be an exclusive author!
More Recommended Snippets:
Topics