Show User’s Public IP address in PHP5

Add the following code to display user’s Public IP Address on your web pages:

 //Gets the visitor IP address
 $ip = getenv(“REMOTE_ADDR”) ;
 Echo “This is your Public IP address ” . $ip;

NOTE: If your visitor is behind a proxy server, then it will return the address of the proxy.

Comments are closed.