So, there is the site "Mail of Russia" - 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, naturally, after closing the page, we will have to enter the identifier again. Recently, I needed to have a direct link to this service, with my identifier (not to enter it every time). And except for GET, nothing came to my mind. After several hours of an inconclusive battle with the address bar and source code. I have nothing left. Maybe someone can help? Or do I try in vain and send data that was not intended for POST by GET?
- You can send, but there is little sense if they are not processed by the server. - Zowie
- those. GET it meaningless to do? Clear ... Let's wait for more Versions :). - BomBom
- @Expert Thank you: D - BomBom
4 answers
Comment
The main difference between the POST and GET methods is the way information is transmitted. In the GET method, parameters are passed through the address bar, i.e. in fact, in the HTTP request header , while in the POST method, the parameters are transmitted through the body of the HTTP request and do not affect the appearance of the address bar .
- AlexWindHope webcorp.ru/page/php_post_get.html There is a lot of text, but the essence is in 4 points at the bottom of the page. - Palmervan
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 by:
<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> The request body is formed here:
request.send("somedata=somevalue"); - Mane needs a link ... and not a script .... or rather, a script, but a link will be better ... and therefore I think - is it really possible at all? - BomBom
GET is sending parameters to the server through the address line, but POST is sending, so to speak, in a hidden form, everything would work if their servers were able to receive data via Get and POST ...
- @AlexWindHope I know perfectly well that their servers are able to process and GET and POST I just had that their parameter can be taken only through the
$_POSTglobal variable, but if they had written and $ _GET then everything would be badkick. - Michael Nikolaev - @Jagry and perhaps ajax can send a request to another domain ??? LOL - Miha Nikolaev
Well, use cookies, if I understand you correctly then something like this:
<input name="id" value="<?=$_COOKIE['previous_id'];"/> and send yourself a post as you please :)
Those. at the first sending, we initialize the cookie, and then just push into the Input
In general, the real solution of 1o is to write your page with a mold and work there with your cookies ... just in the form just specify action="url_to_site"
Essentially did not understand ... Do you want the site to process parameters that are not provided in the processing without having access to the server?
Then it is impossible ...
Miha Nikolaev POST is sending with title
Content_type: application / x-www-form-urlencoded
To write that this hiding data is not entirely correct, if it is not visible in the URL address, this does not mean that they are hidden.
Their servers are able to accept and get and post LOL .. Just GET is not processed.
Palmervan - how is it in the BODY? Explain to me a sinner, I will give a banal premier on JS, and you will show me where I am forming the BODY 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 I'm here form the body? and generally what kind of BODY did you write? xD
The horror, tovarisch kagby GET data is formed about exactly the same as the POST data, not? If you think like you, then when we give GET we also form a body (for me it’s not clear what BODY is xD) What POST is that GET is a string, the difference is in the heading Content-Type, EVERYTHING!
- uh ... It’s not like My Site (What a pity: D). Cookies same site reads. How can I then change the code so that He inserts me every time where I need My cookies? :) - BomBom