This is a discussion on converting GET to POST within the PHP General forums, part of the PHP Programming Forums category; Currently, I am posting via GET to third party server as seen below: $item=urlencode($item); header("Location: https://...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Currently, I am posting via GET to third party server as seen below:
$item=urlencode($item); header("Location: https://www.fake.com/fake.php?item=$item"); I want to reconfigure my header calls to POST instead of using GET for sending $item to third party server. Is this doable? Thank you, Kris |
|
|||
|
--- Kris Yates <kris@2binteractive.com> wrote:
> Currently, I am posting via GET to third party server as seen below: > > $item=urlencode($item); > header("Location: https://www.fake.com/fake.php?item=$item"); > > I want to reconfigure my header calls to POST instead of using GET > for sending $item to third party server. Is this doable? No, you can't force a remote Web client to send a POST request. Maybe this is possible with JavaScript, but I hope not. Chris ===== My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp |
|
|||
|
You can do it this way:
<form action="https://www.fake.com/fake.php"> <input type="hidden" name="item" value="<?= $item ?>"> <input type="submit"> </form> Kris Yates wrote: > Currently, I am posting via GET to third party server as seen below: > > $item=urlencode($item); > header("Location: https://www.fake.com/fake.php?item=$item"); > > I want to reconfigure my header calls to POST instead of using GET for > sending $item to third party server. Is this doable? > > Thank you, > > Kris > |
|
|||
|
>>>>> "Marek" == Marek Kilimajer <kilimajer@webglobe.sk> writes:
>>>>> "Kris" == Kris Yates writes: Marek> You can do it this way: Marek> <form action="https://www.fake.com/fake.php"> Marek> <input type="hidden" name="item" value="<?= $item ?>"> Marek> <input type="submit"> Marek> </form> Actually, I think that if you do it this way, someone will have to click on the submit button. If you want to redirect with a post, then look in to using the CURL library. Marek> Kris Yates wrote: Kris> Currently, I am posting via GET to third party server as seen below: Kris> $item=urlencode($item); Kris> header("Location: https://www.fake.com/fake.php?item=$item"); Kris> I want to reconfigure my header calls to POST instead of using GET Kris> for sending $item to third party server. Is this doable? Kris> Thank you, Kris> Kris Kris> -- no toll on the internet; there are paths of many kinds; whoever passes this portal will travel freely in the world |
|
|||
|
Lee Doolan wrote:
>>>>>>"Marek" == Marek Kilimajer <kilimajer@webglobe.sk> writes: >>>>>>"Kris" == Kris Yates writes: > > > Marek> You can do it this way: > Marek> <form action="https://www.fake.com/fake.php"> > Marek> <input type="hidden" name="item" value="<?= $item ?>"> > Marek> <input type="submit"> > Marek> </form> > > Actually, I think that if you do it this way, someone will have to > click on the submit button. If you want to redirect with a post, then > look in to using the CURL library. > Right. Either that, or remove the submit button, and have JavaScript submit the form on page load. -- By-Tor.com It's all about the Rush http://www.by-tor.com |
|
|||
|
Lee Doolan wrote:
> > Actually, I think that if you do it this way, someone will have to > click on the submit button. If you want to redirect with a post, then > look in to using the CURL library. Kris wants to redirect the user so CURL library would not work for this. |