motzi has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I want to use requests_redirectable method with post(), which will get me to page with 'Location' header.
use LWP::UserAgent;
$aa = LWP::UserAgent->new;
push @{ $aa->requests_redirectable }, 'POST';
$aa->post(...

but 'Location: ' needs a GET/HEAD request, not post, what can i do in minimal way?

Replies are listed 'Best First'.
Re: requests_redirectable method advance
by Anonymous Monk on Nov 05, 2009 at 03:05 UTC
    but 'Location: ' needs a GET/HEAD request, not post, what can i do in minimal way?

    What do you mean?

    use LWP::UserAgent; my $aa = LWP::UserAgent->new; my $rr = $aa->requests_redirectable; push @$rr, 'POST'; $aa->requests_redirectable($rr); my $ua = LWP::UserAgent->new( requests_redirectable => ['GET', 'HEAD', 'POST' ] ); my $push = LWP::UserAgent->new; push @{ $push->requests_redirectable }, 'POST'; print join ' ', @{ $_->requests_redirectable},"\n" for $aa, $ua, $pus +h; __END__ GET HEAD POST GET HEAD POST GET HEAD POST