PHP $_SERVER Variable
This work is licensed under the Creative Commons Attribution Non-Commercial 2.0 UK: England & Wales Licence. This means that you are free to: copy; distribute; and modify this work. It also means that you cannot use it for commercial purposes. Additionally, you must attribute this work to the original author, Thomas Guymer, ideally with a link.
This is just a simple page to show the live output from the PHP variable $_SERVER. This variable is pre-defined in PHP which means that it can be called anywhere and does not have to be initialised. Plus, to state the obvious, as it is PHP it does not rely on JavaScript and so it is quick and cannot be switched off by the user.
[HTTP_X_CC_ID] => ccc02-02
[HTTP_HOST] => www.thomasguymer.co.uk
[HTTP_USER_AGENT] => CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
[HTTP_ACCEPT] => text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_CONNECTION] => close
[HTTP_CACHE_CONTROL] => no-cache
[HTTP_PRAGMA] => no-cache
[HTTP_COOKIE] => ImageSize=small; ThumbSize=thumb
[PATH] => withheld for security reasons
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.2.3 (CentOS)
[SERVER_NAME] => www.thomasguymer.co.uk
[SERVER_ADDR] => 10.9.16.16
[SERVER_PORT] => 80
[REMOTE_ADDR] => 38.107.191.99
[DOCUMENT_ROOT] => withheld for security reasons
[SERVER_ADMIN] => withheld for security reasons
[SCRIPT_FILENAME] => withheld for security reasons
[REMOTE_PORT] => withheld for security reasons
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /tutorials/php-server-variable/
[SCRIPT_NAME] => withheld for security reasons
[PHP_SELF] => withheld for security reasons
[REQUEST_TIME] => 1284053888
}
Using these details you can create one mean web statistics package or just some helpful user related content.
