Page 210 - Open Soource Technologies 304.indd
P. 210
Web Technologies-I
Notes Accept-Language: en
Accept-Encoding: deflate, gzip, x-gzip, identity, *
Connection: Keep-Alive
Host: localhost
Referer: http://localhost/book/utils/
User-Agent: Opera/6.05 (Windows XP; U) [en]
A sample response header might look as follows:
HTTP/1.1 200 OK
Date: Wed, 22nd Jan 2011 11:15:15 GMT
Server: Apache/2.0.43 (Win32) PHP/4.3.0
Last-modified: Wed, 22nd Jan 2011 11:10:47 GMT
9.2 Web Variables
Server configuration and request information including form parameters and cookies are
accessible in three different ways from your PHP scripts, as described in this. Collectively, this
information is referred to as EGPCS (environment, GET, POST, cookies, and server).
If the register_globals option in php.ini is enabled, PHP creates a separate global variable for
every form parameter, every piece of request information, and every server configuration value.
This functionality is convenient but dangerous, as it lets the browser provide initial values for
any of the variables in your program.
Regardless of the setting of register_globals, PHP creates six global arrays that contain the
EGPCS information.
The global arrays are:
$HTTP_COOKIE_VARS
Contains any cookie values passed as part of the request, where the keys of the array are
the names of the cookies.
$HTTP_GET_VARS
Contains any parameters that are the part of a GET request, where the keys of the array
are the names of the form parameters.
$HTTP_POST_VARS
Contains any parameters that are the part of a POST request, where the keys of the array
are the names of the form parameters.
$HTTP_POST_FILES
Contains information about any uploaded files.
$HTTP_SERVER_VARS
Contains useful information about the web server, as described in the next section.
204 LOVELY PROFESSIONAL UNIVERSITY