Re: redirecting cgi via post method

[email protected] ("Mike Blezien")
Newsgroups perl.beginners.cgi
Organization ThunderRain Internet Publishing
Message-ID <000801c75201$2bcba600$04fea8c0@DGGTPQ11>
You may also want to check out the WWW::Mechanize module this will do what your 
looking for.

Mike
----- Original Message ----- 
From: "Mumia W." <[email protected]>
To: "Beginners CGI" <[email protected]>
Sent: Friday, February 16, 2007 12:49 PM
Subject: Re: redirecting cgi via post method


> 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
>
>
>
>
> -- 
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
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.