Find IP address, referrer, uri , operating system using php

1 min


0
3 shares

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";
}



Like it? Share with your friends!

0
3 shares

What's Your Reaction?

LIKE LIKE
0
LIKE
DISLIKE DISLIKE
0
DISLIKE
DAMN DAMN
0
DAMN
CUTE CUTE
0
CUTE
OMG OMG
0
OMG
Junaid Rehman

I am a blogger and freelance web developer by profession. I love to blog and learn new things about programming and IT World.

0 Comments

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.