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] = ZyZ_yktLloQYDcEuzqt58AAAAAE
$_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/oscon2002/25
$_SERVER[HTTP_COOKIE] = PHPSESSID=0sq0vitk3ms6t880hea509fbjn
$_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.149.23.54
$_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] = 50516
$_SERVER[GATEWAY_INTERFACE] = CGI/1.1
$_SERVER[SERVER_PROTOCOL] = HTTP/1.1
$_SERVER[REQUEST_METHOD] = GET
$_SERVER[QUERY_STRING] =
$_SERVER[REQUEST_URI] = /show/oscon2002/25
$_SERVER[SCRIPT_NAME] = /show
$_SERVER[PATH_INFO] = /oscon2002/25
$_SERVER[PATH_TRANSLATED] = /local/Web/sites/talks.php.net/oscon2002...
$_SERVER[PHP_SELF] = /show/oscon2002/25
$_SERVER[REQUEST_TIME_FLOAT] = 1730576330.8309
$_SERVER[REQUEST_TIME] = 1730576330
$_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.