PHP automatically creates global variables containing data from a variety of
external sources. This feature can be turned off by turning off the
register_globals setting. With register_globals
you can access this data via a number of special associative arrays listed below.
$_GET['foo']='bar'
http://www.php.net/index.php?foo=bar
$_POST['foo']='bar'
<form action="script.php" method="POST">
<input type="text" name="foo" value="bar">
</form>
$_COOKIE['foo']='bar'
<?php
SetCookie('foo','bar');
?>
$_REQUEST['foo']='bar'
<?php
SetCookie('foo','bar');
?>
$_SERVER
Special variables set by your web server. You can get a list of what
is set by running this code on your server:
<?php
foreach($_SERVER as $key=>$val) {
echo '$_SERVER['.$key."] = $val<br>\n";
}
?>
$_SERVER[UNIQUE_ID] = Z0RewEZ1VBA9luh892YpDAAAAAI
$_SERVER[HTTPS] = on
$_SERVER[SSL_TLS_SNI] = talks.php.net
$_SERVER[HTTP_ACCEPT_ENCODING] = gzip
$_SERVER[HTTP_HOST] = talks.php.net
$_SERVER[HTTP_ACCEPT] = */*
$_SERVER[HTTP_USER_AGENT] = Mozilla/5.0 AppleWebKit/537.36 (KHTML, l...
$_SERVER[HTTP_REFERER] = http://talks.php.net/show/lugod/24
$_SERVER[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin...
$_SERVER[SERVER_SIGNATURE] = <address>Apache/2.4.62 (Debian) ...
$_SERVER[SERVER_SOFTWARE] = Apache/2.4.62 (Debian)
$_SERVER[SERVER_NAME] = talks.php.net
$_SERVER[SERVER_ADDR] = 91.199.167.250
$_SERVER[SERVER_PORT] = 443
$_SERVER[REMOTE_ADDR] = 3.140.197.140
$_SERVER[DOCUMENT_ROOT] = /local/Web/sites/talks.php.net
$_SERVER[REQUEST_SCHEME] = https
$_SERVER[CONTEXT_PREFIX] =
$_SERVER[CONTEXT_DOCUMENT_ROOT] = /local/Web/sites/talks.php.net
$_SERVER[SERVER_ADMIN] = [no address given]
$_SERVER[SCRIPT_FILENAME] = /local/Web/sites/talks.php.net/show
$_SERVER[REMOTE_PORT] = 30624
$_SERVER[GATEWAY_INTERFACE] = CGI/1.1
$_SERVER[SERVER_PROTOCOL] = HTTP/1.1
$_SERVER[REQUEST_METHOD] = GET
$_SERVER[QUERY_STRING] =
$_SERVER[REQUEST_URI] = /show/lugod/24
$_SERVER[SCRIPT_NAME] = /show
$_SERVER[PATH_INFO] = /lugod/24
$_SERVER[PATH_TRANSLATED] = /local/Web/sites/talks.php.net/lugod/24
$_SERVER[PHP_SELF] = /show/lugod/24
$_SERVER[REQUEST_TIME_FLOAT] = 1732533952.4776
$_SERVER[REQUEST_TIME] = 1732533952
$_ENV
Environment variables that were present at server startup time. Note that environment
variables created by PHP using putenv() will not be shown here,
nor do they persist beyond the request.
$_FILES
Used for the RFC1867 file upload feature.
$_FILES['userfile']['name']
$_FILES['userfile']['type']
$_FILES['userfile']['size']
$_FILES['userfile']['tmp_name']
$HTTP_RAW_POST_DATA
When the mime type associated with the POST data is unrecognized or not set, the
raw post data is available in this variable.