Is there a difference between Post and Request?

5

When I read about request I always get the term post together, and this raises a question. I understand that request serves to make a request for something to the server and then the server sends a response after processing such a request, and reading about the post it seems that it does the same thing, and it is at this point that it raises the doubt, I can not understand the difference between them.

Question

I would like to know if there is a difference between Request and Post , if it exists, I would like to know the main differences between them and also the main purpose of > Post ?

Feel free to give practical examples in any programming language if you wish.

    
asked by anonymous 25.09.2016 / 20:01

2 answers

5

request is a generic way of referring to the subject, we can use the translation that will be as well or better understood as an information request to the server. There are several ways to make a request. The term could be used in other contexts and be the same thing, it has no specific meaning in technology, it is just a word needed to give understanding to what is being used. In this context it is a request using HTTP.

In HTTP, among the various forms of requesting, has the verb used to request it. Each verb has its own semantics to function. One of these verbs is POST . So this term is a very specific form, with proper rules of how to make the requisition. So this is a term with technical meaning defined in the specification.

I've given a answer by differentiating between POST and PUT which shows the main details of POST .

Have another one with basic information about other verbs . And the importance of using the correct verbs . All of these verbs are requisition methods .

You can better understand all this work in the CGI question .

    
25.09.2016 / 20:23
1

Supplemented the response with an example in PHP .

POST

The post uses the Uniform Resource Identifier (URI) to send information to the server, which, because it is not returnable to the client, makes the method more secure as it does not expose the sent data in the browser.

From post , you create the entire form structure necessary for the operation of web applications. With it you can get the data of a certain field:

<FORM NAME=”form1″ METHOD=”post” ACTION=”pagina.php”>
   Campo 1:
   <INPUT TYPE=”text” NAME=”campo1″>
   <BR>
   Campo 2:
   <TEXTAREA NAME=”campo2″></TEXTAREA>
   <BR>
   <INPUT TYPE=”submit” VALUE=”Enviar”>
</FORM>

<?php
   echo(“O valor do primeiro campo é ” . $_POST[‘campo1’]);
   echo(“O valor do segundo campo ” . $_POST[‘campo2’]);
?>

REQUEST

$_REQUEST , by default, contains the contents of $_GET , $_POST and $_COOKIE . It is called a generic collection, because it returns the value of the variable, according to the configuration of the file php.ini :

<FORM NAME=”form1″ METHOD=”post” ACTION=”pagina.php?x=1″>
   <INPUT TYPE=”text” NAME=”txtCampo1″ VALUE=”Valor do Campo Texto”>
   <INPUT TYPE=”submit” VALUE=”Enviar”>
</FORM>

<?php
   echo($_REQUEST[‘v’]);
?>

See this answer for stackoverflow in English.


References:

26.09.2016 / 16:50