The GET Method

With the GET method, the query string is simply appended to the URL of the program when the client issues the request to the server. This query string can then be accessed by using the environment variable QUERY_STRING.


Example of a GET request :

GET /cgi-bin/formulaire.cgi?parameter1=value1&paremeter2=value2… HTTP/1.1
The server takes the red part and assigns it to the QUERY_STRING enviroment variable. It begins after the "?" character.


With the GET method, you can access the CGI program with a query without using a form if you want to send query to the program directly.


Example :

<A HREF="/cgi-bin/program.pl?user=Larry%20Bird&age=35&pass=testing">CGI Program</A>
An URL cannot contain space and special characters. That’s why special characters are coded with their hexadecimal values preceded by %. That’s true for both the methods GET and POST