introduction to web programming The GET Method The foundation of HTTP/0.9 (the first implementation of the HTTP protocol) was the definition of the GET method that was used by a web browser to request a specific document.

For example, the following HTTP request would return the document "index.html" that was located in the web server's root directory called "webdocs"

GET /webdocs/index.html CRLF

Notice that the GET request began with the GET keyword, included a document to retrieve, and ended with a carriage return and line feed combination.

If you would like, you can try making a GET request by connecting to your favorite web server and sending the GET request yourself (as if you were a web browser).

Below is a GET session I cut and pasted from a telnet window. In this case, I used telnet to contact the web server "www.extropia.com" and asked for the file "irobot.html" in the "Scripts/Columns" directory (Don't forget the two carriage returns at the end). The server responded by sending me the contents of that file (the HTML code you see).

[Get Session]

The beauty of web browsers of course, is that they take care of the HTTP protocol specifications so that the user only needs to enter the URL of the page they want to see. The web browser formulates the actual GET request, sends it to the web server, receives the HTML document back, and then displays the HTML document according to the HTML instructions.

Previous | Next | Table of Contents