Server Variables

$_SERVER is an array keyword that lets you access CGI related variables along with available HTTP variables.

The variables can be access like so:

put $_SERVER["PATH_TRANSLATED"] into myVar

Available keywords (with an example of the value they return) include (not yet checked everything in this list):

GATEWAY_INTERFACE returns the CGI interface version (e.g. CGI/1.1 )
SERVER_ADDR ::1
SERVER_NAME localhost / www.activethought.net
SERVER_SOFTWARE software the server is running (e.g. Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6 )
SERVER_PROTOCOL HTTP/1.1
REQUEST_METHOD GET or POST, usefull to see how the current page was accessed
REQUEST_TIME
QUERY_STRING the GET values of the current url
DOCUMENT_ROOT C:/xampp/htdocs 
HTTPS
REMOTE_USER
REDIRECT_REMOTE_USER
REMOTE_ADDR visitors ip address
REMOTE_HOST
REMOTE_PORT 56339
SERVER_ADMIN returns the admin email address of your server
SERVER_PORT the current port you are using to access the server (usually will be port: 80)
SERVER_SIGNATURE returns the server signature (e.g. Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6 Server at localhost Port 80)
PATH_TRANSLATED C:/xampp/htdocs/xampp/lc.lc
REQUEST_URI /xampp/lc.lc?x=x 
PATH_INFO
SCRIPT_NAME /livecode-cgi/livecode-community-server.exe 
SCRIPT_FILENAME C:/xampp/livecode/livecode-community-server.exe 
CONTENT_TYPE
CONTENT_LENGTH
HTTP_USER_AGENT e.g. Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36
HTTP_CONNECTION keep-alive
HTTP_HOST localhost
HTTP_ACCEPT_ENCODING gzip,deflate,sdch
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.8
DOCUMENT_ROOT C:/xampp/htdocs
HTTP_COOKIE
HTTP_REFERER shows the referring url

Leave a Reply