Get and Post requests.

So, there is a site Russian Post– it has a service where you can see the status of your parcels. Having entered the identifier, we pass it to the script using the POST method. But, of course, after closing the page, we will again have to enter the identifier. Recently, I needed to have a direct link to this service, with my ID (so that I don’t have to enter it every time). And except for GET, nothing came to my mind. After several hours of fruitless battle with the address bar and source code. I didn’t get anything. Maybe someone can help? Or am I trying in vain and send data that was not supposed to be for POST’a GET’om?


Answer 1, authority 100%

I understand that you want to place this link on your page?
Then the question is:

<form id="form" action="..>
<input type="hidden" name=".post." value="">
</form>
      <a href="javascript:form.submit()"></a>

Added:

<script type="text/javascript">
var request = new XMLHttpRequert();
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
request.open("POST","server.php", true);
request.send("somedata=somevalue");
</script>

Request body is formed here:

request.send("somedata=somevalue");

Answer 2, authority 67%

Note

The main difference between POST and GET methods
lies in the mode of transmission
information. In the GET method, parameters
are transmitted via the address bar, i.e.
essentially in the HTTP headerof the request, while
time as in POST method parameters
are passed through the bodyof the HTTP request and
are not reflected in any way in the form of the address
strings
.


Answer 3, authority 33%

GET is sending parameters to the server through the address bar, but POST is sending, so to speak, in a hidden form, everything would work if their servers could receive data both via Get and POST…


Answer 4

Well, use cookies, if I understand you correctly, something like this:

<input name="id" value="<?=$_COOKIE['previous_id'];"/>

and post to yourself as much as you like 🙂

Those. on the first send, we initialize the cookie, and then just shove it into Input

In general, the real solution is 1o – write your own page with a form and work with your cookies there …
just put action="url_to_site"in the form

I still don’t get the point… Do you want the site to process parameters that are not provided for processing without access to the server?

Then it’s impossible…

Mikha Nikolaev
POST is a send with header
Content_type: application/x-www-form-urlencoded
Writing that this data is hidden is not entirely correct, if it is not visible in the URL, this does not mean that it is hidden

Their servers can accept both get and post. LOL.. It’s just that GET is not processed.


Palmervan– how is it in the BODY? O
o explain to me a sinner, I will give a banal example in JS, and you will show me where I form the BODY there xD

<script type="text/javascript">
var request = new XMLHttpRequert();
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
request.open("POST","server.php", true);
request.send("somedata=somevalue");
</script>
 
<?
    print_r($_POST);
?>

And where am I shaping a BODY here? And in general, what kind of body did you write about? xD


Horror, comrades, when GET data is formed approximately exactly the same as POST data, isn’t it? If you think like you, then when we give GET we also form a body (for me it’s not at all clear what kind of BODY we are talking about xD) What is POST and GET is a string, the difference is in the Content-Type header, EVERYTHING!
< br>