HTTP:
HTTP is the foundation of data commnication of the World Wide Web. The basic work method of http is request and response.
There are two methods of HTTP request: Get and Post.
Get - get request data from specific source.
Post - Push data which will be dealed to specific source.
GET:
Note that the query string (name/value pairs) is sent in the URL of a GET request:
http://www.w3schools.com/tags/ref_httpmethods.asp
Some other notes on GET requests:
GET requests can be cached
GET requests remain in the browser history
GET requests can be bookmarked
GET requests should never be used when dealing with sensitive data
GET requests have length restrictions
GET requests should be used only to retrieve data
POST:
Note that the query string (name/value pairs) is sent in the HTTP message body of a POST request:
POST /test/demo_form.asp HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2
Some other notes on POST requests:
POST requests are never cached
POST requests do not remain in the browser history
POST requests cannot be bookmarked
POST requests have no restrictions on data length
Compare GET vs. POST:
Tables | GET | POST |
---|---|---|
BACK button/Reload | Harmless | Data will be re-submitted |
Bookmarked | can be bookmarked | Can not be bookmarked |
Cached | Can be cached | Can not be cached |
History | Parameters remain in browser history | Parameters are not saved in browser history |
Restrictions on data length | Yes | No |
Security | Less secure | Safer |
Visibility | Visible | Not visible in URL |
Reference: http://www.w3schools.com/tags/ref_httpmethods.asp