CGI Script Structure

When your script is invoked by the server, the server passes information to the script via environment variables and, in the case of the HTTP POST method, via STDIN. GET and POST are the two most common request methods you'll encounter, and probably the only ones you'll need. The request method tells your script how it was invoked; based on that information, the script can decide how to act. The request method is passed to your script using the environment variable (see "Standard CGI Environment Variables" later in this chapter) called, appropriately enough, REQUEST_METHOD.

  • GET is a request for data, the same method used for obtaining static documents. The GET method sends request information as parameters tacked onto the ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.