HTTP POST redirect

Is there a way to create an HTTP POST redirect? So when the user is
redirected, the browser visits that URL but POSTs to it instead of
GETting it.

Pat

Pat M. wrote:

Is there a way to create an HTTP POST redirect? So when the user is
redirected, the browser visits that URL but POSTs to it instead of
GETting it.

Pat

I think if the browsers sends a POST and then gets a 301 redirect
response, the browser will POST the same thing to the redirected url as
well.

I don’t think there is a way to force the browser to send a POST after
being redirected from a GET.

On 2/12/07, Alex W. [email protected] wrote:

well.
I just did a brief demo and the browser will GET the redirected URL.
Bummer. Any other ideas?

Pat

You can try doing this using curl. This example is in php but
there’s a ruby lib out there too.

$g = curl_init();
curl_setopt($g,CURLOPT_URL,‘http://urltopostto.com’);
curl_setopt($g, CURLOPT_POST, 1);
curl_setopt($sessions,CURLOPT_POSTFIELDS,"foo=bar&andy=cool);
print curl_exec($g);

You could also do this by loading a page using a GET then using
javascript to click on a form post button on the window load.

Andy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs