Code - Cheat Sheet

Wednesday, May 27, 2020

What is the difference between post and get methods?


  • With get, data is included in the form body when send to the server. With post, the data goes through the URL
  • HTTP's purpose is to enable communications between clients and servers

EXAMPLE:

Image Source:
https://www.tutorialexample.com/a-simple-way-to-get-file-extension-in-php-php-tutorial/


GET

/test/demo_form.php?name1=value1&name2=value2


Notes

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 are only used to request data (not modify)

  • The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.


POST


POST /test/demo_form.php HTTP/1.1
Host: w3schools.com
name1=value1&name2=value2



Notes

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

  • A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.


HTTP Methods
  • GET
  • POST
  • PUT
  • HEAD
  • DELETE
  • PATCH
  • OPTIONS
The two most common HTTP methods are: GET and POST.



SOURCES:

https://www.w3schools.com/tags/ref_httpmethods.asp

https://www.tutorialspoint.com/http/http_requests.htm

No comments:

Post a Comment

Panels

Panels are the items at the right side of the Photoshop window that can display layer information and text options SOURCE: https://www...