PHP Server – Get the client IP address

In this post we will be creating a PHP script that will return the client IP address, to do this we will be using the ‘$_SERVER’ variable which contains server and execution environment information

The ‘$_SERVER’ is an array and in this post we will be retrieving the ‘REMOTE_ADDR()’ item, see the snippet of code below for how this is done.

echo $IP

Leave a Reply