POST requests differ from GET requests.
- Data is sent to the server in the body, with headers describing the
body
- The URI is usually identifies a script needed for processing the
data--not a file to be retrieved
- The returned data is typically a product of a program--not an
existing file
Example
The URL http://www.census.gov/cgi-bin/ipc/idbsum?cty=US&optyr=latest+checked&tbl=001
shows a summary demographic data for the USA. The returned web page can
be requested through the following script.
telnet www.census.gov 80
Trying 148.129.75.16...
Connected to www.census.gov.
Escape character is ’^]’.
POST /cgi-bin/ipc/idbsum HTTP/1.0
POST /cgi-bin/ipc/idbsum HTTP/1.0
Content-Type: application/x-www-form-urlencoded
Content-Type: application/x-www-form-urlencoded
Content-Length: 35
Content-Length: 35
cty=US&optyr=latest+checked&tbl=001
cty=CH&optyr=latest+checked&tbl=001
HTTP/1.1 200 OK
Date: Mon, 12 Jan 2004 04:44:38 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c
PHP/4.3.4
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
.
.
.
Connection closed by foreign host.
The following scripts demonstrates an equivalent GET request.
telnet www.census.gov 80
Trying 148.129.75.16...
Connected to www.census.gov.
Escape character is ’^]’.
GET /cgi-bin/ipc/idbsum?cty=US&optyr=latest+checked&tbl=001
HTTP/1.0
GET /cgi-bin/ipc/idbsum?cty=US&optyr=latest+checked&tbl=001
HTTP/1.0
HTTP/1.1 200 OK
Date: Mon, 12 Jan 2004 05:09:44 GMT
Server: Apache/2.0.48 (Unix) mod_ssl/2.0.48 OpenSSL/0.9.7c
PHP/4.3.4
Connection: close
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
.
.
.
Connection closed by foreign host.