Today i will teach you how to find IP address, referrer, uri , operating system using php. We will use $_SERVER to get all this information.

Php Information

Php Information

$_SERVER[‘HTTP_REFERER’] is used to get the url of the page that refered the user to the current location.
$_SERVER[‘REMOTE_ADDR’] is used the get the client IP address
$_SERVER[‘REQUEST_URI’] is used to get the uri of the URL. For example the uri of http://localhost/mysite/index.php is /mysite/index.php/
$_SERVER[‘HTTP_USER_AGENT’] is used to get the user agent to the client for example you are using firefox or ie. It also tells that which operation system you are using.

You can see more $_SERVER predefined variables by using the following code as below:


foreach ($_SERVER as $var => $value) {
echo "$var => $value";
}