Of all these functions that return current visitors info/ip only the first one seems to output:
echo $_SERVER["REMOTE_ADDR"];
echo $_SERVER["HTTP_X_FORWARDED"];
echo $_SERVER["HTTP_X_CLUSTER_CLIENT_IP"];
echo $_SERVER["HTTP_FORWARDED_FOR"];
echo $_SERVER["HTTP_FORWARDED"];
Primary Question: Why the other functions dont output anything?
Bonus Question: Are there any other cool functions in this regard for example a function that outputs the visitors used browser & platform?? Also usefull would be to get the visitors city, favourite beverage, favourite color in #RGB... :) Thanks for any suggestions!
HTTP_
in them)$_SERVER["REMOTE_ADDR"]
Why the other functions dont output anything?
Because these HTTP headers are optional.
Are there any other cool functions
Sure
print_r($_SERVER);
will show you them all
Note get_browser() function which helps you to get more structured info out of User-Agent header.
Using $_SERVER['HTTP_USER_AGENT'] will get you something like:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418 (KHTML, like Gecko) Safari/417.9.3
Which you can use to work out the operating system and browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With