Re: redirecting cgi via post method

[email protected] ("Mumia W.")
Newsgroups perl.beginners.cgi
Message-ID <[email protected]>
On 02/16/2007 12:00 PM, [email protected] wrote:
> Greetings,
> 
>   I have a CGI that receives some parameters, and after processing them 
> (it generates a file) it must be redirected to another CGI (external 
> domain) to process it.
> 
>   What I want to do is similar to
>     
> redirect("http://somedomain.com/cgi-bin/myscript.cgi?param1=some&param2=stuff"); 
> 
> 
> but using POST method instead of GET.
> 
> 
> At first point, I imagine a solution with LWP::UserAgent using the POST 
> method for the new user agent; but later, I don't know how to be 
> redirected to the new address.
> 
>   my $ua_this = LWP::UserAgent->new;
>   $ua_this->post("http://somedomain.com/cgi-bin/myscript.cgi", [
>     param1 => "some",
>     param2 => "stuff"
>     ] );
> 
>  redirect($ua_this); # <-this? I don't think so
> 
> 
> Any help will be appreciated.
> 
> 
> Alejandro

You probably want a status 307 redirect:

use strict;
use warnings;
use CGI;

# You set the $location.

print CGI::header(
     -status => '307 Temporary Redirect',
     -location => $location,
);

__HTH__

HTTP Spec: ftp://ftp.isi.edu/in-notes/rfc2616.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.