converting GET to POST

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://...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-16-2003
Kris Yates
 
Posts: n/a
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 (permalink)  
Old 10-16-2003
Chris Shiflett
 
Posts: n/a
Default Re: [PHP] converting GET to POST

--- 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
Reply With Quote
  #3 (permalink)  
Old 10-16-2003
Marek Kilimajer
 
Posts: n/a
Default Re: [PHP] 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>

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
>

Reply With Quote
  #4 (permalink)  
Old 10-16-2003
Lee Doolan
 
Posts: n/a
Default Re: [PHP] converting GET to POST

>>>>> "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
Reply With Quote
  #5 (permalink)  
Old 10-16-2003
John Nichel
 
Posts: n/a
Default Re: [PHP] converting GET to POST

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
Reply With Quote
  #6 (permalink)  
Old 10-16-2003
Marek Kilimajer
 
Posts: n/a
Default Re: [PHP] converting GET to POST

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.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:47 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0