I know there are GET and POST methods but I don’t know how to apply them.
Understanding the semantics of methods HTTP
is essential for programming web applications. I will try to explain the differences between GET and POST, but first you have to realize the following concepts:
Idempotent - Something that can be applied several times, always generating the same result. A simple example is multiplication by 1. You can multiply any number by 1 as many times as you want that you will always get the original number.
Secure - An order is considered secure if it does not change status on the Server
The GET method should be Indempotent and secure, meaning whenever you can get a resource without changing status, the GET method is a good candidate.
The POST method is neither Indempotent nor Safe, and can be used for example to change state in an object.
The DELETE method is Indempotent but it is not safe, you can make a request to delete a resource as many times as you want that the system should only delete it 1 time, but changes the state.
So if the request you are making to your test page is indempotent, safe and you can use the query string to pass the data you can use the method GET
to do so.
I don’t know PHP but I think user Santana gave an example of how to get data from query string.
While the post data is not visible in the URL, it is clearly visible in the request body
HTTP
, normally in formatapplication/x-www-form-urlencoded
(key value pairs, such as the query string) and therefore are no longer secure. Unless usedHTTPS
– Bruno Costa
parallel connection to the POST?
– Daniel Omine