previous |
start |
next
Common Gateway Interface (CGI)
CGI defines the way in which form data is presented to an
application program by the HTTP server.
When a user clicks the SUBMIT
button on a
form, the HTTP server starts up the specified CGI program, and
makes the form data available to it.
A difference between GET
and
POST
is the way in which a CGI program receives
the form data. If the method was GET
, the
information is usually obtained by examining the contents of an
environment variable (usually called
"QUERY_STRING
) containing the URL-encoded form
data. Other environment variables contain additional useful
information.
If the method was POST
, the CGI program
usually receives the form data on its standard
input stream, with any extra stuff obtained, as before,
from environment variables.
CGI programs can, as a rule, be written in any language (compiled
or interpreted) supported on the system running the HTTP
server.
On Unix servers, they are commonly written in
Perl
, C
or as Bourne shell
(/bin/sh
) scripts.
A CGI program (almost) always generates (to standard output) a Web
page which is returned to the browser, in addition to any other
effect.
previous |
start |
next