An Introduction to CGI - The Common Gateway Interface
by Jay Eckles
Retrieving a Cookie
The value of a cookie can be retrieved by examining the value of the
environment variable HTTP_COOKIE which contains a semi-colon delimited
list of cookie variable name/value pairs that have been set from your
domain and are valid on your path. If you have set two cookies on a
client's machine with name/values of name=Jay and age=20, then when the client requests a document (calls a
CGI gateway program) for which these cookies are valid, then the value
of the environment variable HTTP_COOKIE would be
name=Jay;age=20
The programming language that you are using to write your gateway
program may also have built-in mechanisms for retrieving cookies.
JavaScript and VBScript, and ASP are examples. In the cases of
JavaScript and VBScript, the cookie may even be set and retrieved in a
client-side script embedded in HTML.
[Contents] [Next] [Previous]
If you have any questions or would like to contact me for any reason, please email me at j.eckles@computer.org.
|