Request Methods

As I mentioned in the previous chapter, you can control which method a form submission uses using the method attribute of the form tag. Web servers accept three types of requests: GET, POST, and HEAD. A request from a program to a Web server looks like this:

GET /index.html HTTP/1.0 

The first part of the request, which is GET in this case, is the method for that request. The second part, /index.html, is the URL being requested. The third part of the request, HTTP/1.0, is the protocol that the client is using.

There are generally additional header lines that are included with the request, but the request line itself is all that ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition 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.