Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > converting GET to POST
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 3rd July 08:29
kris
External User
 
Posts: 1
Default converting GET to POST



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
  Reply With Quote


 


2 3rd July 08:29
shiflett
External User
 
Posts: 1
Default converting GET to POST



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
  Reply With Quote


 


3 3rd July 08:29
kilimajer
External User
 
Posts: 1
Default converting GET to POST


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>
  Reply With Quote
4 3rd July 08:29
leed_25
External User
 
Posts: 1
Default converting GET to POST


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.

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
  Reply With Quote
5 3rd July 08:29
jnichel
External User
 
Posts: 1
Default converting GET to POST


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
  Reply With Quote
6 3rd July 08:29
kilimajer
External User
 
Posts: 1
Default converting GET to POST


Kris wants to redirect the user so CURL library would not work for this.
  Reply With Quote
Reply


Thread Tools
Display Modes




666