1 specification
(available at the National Center for Supercomputing Applications at http://
hoohoo.ncsa.uiuc.edu/cgi/env.html). You??™ll likely find all of these variables to be quite
useful in your applications, some of which include the following:
CHAPTER 3 ?– PHP BASICS 83
$_SERVER['HTTP_REFERER']: The URL of the page that referred the user to the
current location.
$_SERVER['REMOTE_ADDR']: The client??™s IP address.
$_SERVER['REQUEST_URI']: The path component of the URL. For example, if the
URL is http://www.example.com/blog/apache/index.html, the URI is /blog/apache/
index.html.
$_SERVER['HTTP_USER_AGENT']: The client??™s user agent, which typically offers information
about both the operating system and the browser.
Retrieving Variables Passed Using GET
The $_GET superglobal contains information pertinent to any parameters passed using
the GET method. If the URL http://www.example.com/index.html?cat=apache&id=157 is
requested, you could access the following variables by using the $_GET superglobal:
$_GET['cat'] = "apache"
$_GET['id'] = "157"
The $_GET superglobal by default is the only way that you can access variables
passed via the GET method. You cannot reference GET variables like this: $cat, $id. See
Chapter 21 for more about safely accessing external data.
Retrieving Variables Passed Using POST
The $_POST superglobal contains information pertinent to any parameters passed using
the POST method.
Pages:
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168