Hyper Text Transfer Protocol (HTTP) is an application protocol which is the backbone of world wide web. It works as request-response protocol for the client-server architectures. So your browser on computer, mobile will be a client and the system hosting the website that you are visiting will be a server.
Now there are two common methods of communication between client and server - GET & POST. Communication could be you searching for something on Google, logging into your Facebook account.
The GET Method :-
- In GET method, name-value pairs are passed with the URL itself, which means the parameters are visible in the browser address bar. e.g. www.example.com/find?name=test
- Since the parameters are visible in the browser, GET based addresses can be bookmarked, so that the same websites (with desired arguments) can be visited again.
- There are length restrictions on URL, so GET method can't be used for passing large data to the server.
- Sensitive data such as passwords should NEVER be passed using GET requests.
- GET methods can be cached and the requests are made every time on refreshing the browser.
- GET method is usually used when querying for data from the server.
The POST Method :-
- In POST method, name-value pairs are passed in the HTTP message body of POST request.
e.g. POST /find HTTP/1.1
HOST example.com
name=test
- In case of POST, parameters are not visible in the browser, so such URL requests can't be bookmarked and rather user has to submit the form information every time using the parent page.
- POST methods are used for passing sensitive information like passwords etc.
- Browser will warn for submission of POST data on subsequent refresh.
- POST method is usually used for modifying the data at the server.
Comments
Post a Comment