Are there differences between Post and Request?

Asked

Viewed 1,284 times

6

When I read regarding the request I always get the term post together, and that raises me a doubt. I understand that the request serves to make a request for something to the server and then the server sends a reply after processing the request, and when reading about the post it seems to me that it does the same thing, and it is at this point that it generates doubt, I cannot understand the difference between them.


Question

I wonder if there’s a difference between Request and Post, if any, 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 like.

  • Is your doubt between Post and Get? Or both?

  • @Sergio I’m studying Http, I still know what is Get, if to understand the difference between Post and Request it is necessary to understand what is Get, can explain about it tbm :).

  • 1

    Some related things: http://answall.com/q/118213/101, http://answall.com/q/49322/101, http://answall.com/q/93308/101, http://answall.com/q/9419/101, http://answall.com/q/92870/101

  • post e um metodo de requisicao existe outros varios tipos de metodo como get put header se Voce quer vc pode até criar o seu acho qu e isso requisicao e o que todos clientes http fazem entre outros protocolo agora post e só um metodo desta requisicao Voce pode teste suas requisicoes on this https site://httpbin.org/

  • 1

    In PHP at least, $_POST is the data from the form (method POST). $_REQUEST is the mix of data Post, Get, Cookie. It is the first thing that comes to mind :D

2 answers

6


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

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

I gave a differing answer about POST and PUT which shows the main details of the POST.

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

You can better understand all this working on question about CGI.

2

Supplemented by an example in PHP.


POST

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

From the post the whole structure of the form necessary for the operation of the web applications is created. With it it is possible to obtain the data of a given 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 content of $_GET, $_POST and $_COOKIE. It is called the generic collection, because it returns the value of the variable, according to file configuration 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’]);
?>

Look at this reply stackoverflow.


References:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.