Web consists of billions of clients and server connected through wires and wireless networks. The web clients make requests to web server. The web server receives the request, finds the resources and return the response to the client. When a server answers a request, it usually sends some type of content to the client. The client uses web browser to send request to the server. The server often sends response to the browser with a set of instructions written in HTML(HyperText Markup Language). All browsers know how to display HTML page to the client.
A website is a collection of static files(webpages) such as HTML pages, images, graphics etc. A Web application is a web site with dynamic functionality on the server. Google, Facebook, Twitter are examples of web applications.
HTTP request can be made using a variety of methods, but the ones you will use most often are Get and Post. The method name tells the server the kind of request that is being made, and how the rest of the message will be formated.
HTTP Methods and Descriptions :
|OPTIONS||Request for communication options that are available on the request/response chain.|
|GET||Request to retrieve information from server using a given URI.|
|HEAD||Identical to GET except that it does not return a message-body, only the headers and status line.|
|POST||Request for server to accept the entity enclosed in the body of HTTP method.|
|DELETE||Request for the Server to delete the resource.|
|CONNECT||Reserved for use with a proxy that can switch to being a tunnel.|
|PUT||This is same as POST, but POST is used to create, PUT can be used to create as well as update. It replaces all current representations of the target resource with the uploaded content.|
|Data is sent in header to the server||Data is sent in the request body|
|Get request can send only limited amount of data||Large amount of data can be sent.|
|Get request is not secured because data is exposed in URL||Post request is secured because data is not exposed in URL.|
|Get request can be bookmarked and is more efficient.||Post request cannot be bookmarked.|
Following are some basic differences between the PUT and the POST methods :
/bookswill create a resources that will live under the
/books/1. Sending the same post request twice will create two resources.
Get request contains path to server and the parameters added to it.
Post requests are used to make more complex requests on the server. For instance, if a user has filled a form with multiple fields and the application wants to save all the form data to the database. Then the form data will be sent to the server in POST request body, which is also known as Message body.