Advertisement
abdoo79

script for an cherre

May 17th, 2016
2,264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. HTTP Methods: GET vs. POST
  2. « PreviousNext Reference »
  3. The two most used HTTP methods are: GET and POST.
  4.  
  5. What is HTTP?
  6. The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.
  7.  
  8. HTTP works as a request-response protocol between a client and server.
  9.  
  10. A web browser may be the client, and an application on a computer that hosts a web site may be the server.
  11.  
  12. Example: A client (browser) submits an HTTP request to the server; then the server returns a response to the client. The response contains status information about the request and may also contain the requested content.
  13.  
  14. Two HTTP Request Methods: GET and POST
  15. Two commonly used methods for a request-response between a client and server are: GET and POST.
  16.  
  17. GET - Requests data from a specified resource
  18. POST - Submits data to be processed to a specified resource
  19. The GET Method
  20. Note that the query string (name/value pairs) is sent in the URL of a GET request:
  21.  
  22. /test/demo_form.asp?name1=value1&name2=value2
  23. Some other notes on GET requests:
  24.  
  25. GET requests can be cached
  26. GET requests remain in the browser history
  27. GET requests can be bookmarked
  28. GET requests should never be used when dealing with sensitive data
  29. GET requests have length restrictions
  30. GET requests should be used only to retrieve data
  31. The POST Method
  32. Note that the query string (name/value pairs) is sent in the HTTP message body of a POST request:
  33.  
  34. POST /test/demo_form.asp HTTP/1.1
  35. Host: w3schools.com
  36. name1=value1&name2=value2
  37. Some other notes on POST requests:
  38.  
  39. POST requests are never cached
  40. POST requests do not remain in the browser history
  41. POST requests cannot be bookmarked
  42. POST requests have no restrictions on data length
  43. Compare GET vs. POST
  44. The following table compares the two HTTP methods: GET and POST.
  45.  
  46.     GET POST
  47. BACK button/Reload  Harmless    Data will be re-submitted (the browser should alert the user that the data are about to be re-submitted)
  48. Bookmarked  Can be bookmarked   Cannot be bookmarked
  49. Cached  Can be cached   Not cached
  50. Encoding type   application/x-www-form-urlencoded   application/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data
  51. History Parameters remain in browser history    Parameters are not saved in browser history
  52. Restrictions on data length Yes, when sending data, the GET method adds the data to the URL; and the length of a URL is limited (maximum URL length is 2048 characters) No restrictions
  53. Restrictions on data type   Only ASCII characters allowed   No restrictions. Binary data is also allowed
  54. Security    GET is less secure compared to POST because data sent is part of the URL
  55.  
  56. Never use GET when sending passwords or other sensitive information!    POST is a little safer than GET because the parameters are not stored in browser history or in web server logs
  57. Visibility  Data is visible to everyone in the URL  Data is not displayed in the URL
  58. Other HTTP Request Methods
  59. The following table lists some other HTTP request methods:
  60.  
  61. Method  Description
  62. HEAD    Same as GET but returns only HTTP headers and no document body
  63. PUT Uploads a representation of the specified URI
  64. DELETE  Deletes the specified resource
  65. OPTIONS Returns the HTTP methods that the server supports
  66. CONNECT Converts the request connection to a transparent TCP/IP tunnel
  67.  
  68.  
  69. « PreviousNext Reference »
  70.  
  71. W3SCHOOLS EXAMS
  72.  
  73. HTML, CSS, JavaScript, PHP, jQuery, Bootstrap and XML Certifications
  74. COLOR PICKER
  75.  
  76.  colorpicker
  77. LEARN MORE:
  78.  
  79. Color Converter
  80. Google Maps
  81. Animated Buttons
  82. Modal Boxes
  83. Modal Images
  84. Tooltips
  85. Loaders
  86. JS Animations
  87. Progress Bars
  88. Dropdowns
  89. Slideshow
  90. Side Navigation
  91. HTML Includes
  92. Color Palettes
  93. Code Coloring
  94.  
  95. SHARE THIS PAGE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement