The following example shows how you can get the IP address of the remote host making the request by using the
CGI.REMOTE_ADDR CGI server variable.
And the output of the previous snippet is as follows:
If you want to determine whether the specified IP address is the localhost, you can use the
isLocalHost() function, as seen in the following example:
You can also get the localhost IP address using the
getLocalHostIP() function, as seen in the following example: