halfcountplus has asked for the wisdom of the Perl Monks concerning the following question:
I've been looking thru the docs for the various HTTP base classes here for a way to set this behaviour but haven't found anything yet.use LWP::UserAgent; use HTTP::Cookies; sub new { my $self = {}; my $apiphp = "http://localhost/wiki/api.php"; my $header = HTTP::Headers->new(Content_Type => "application/x-www +-form-urlencoded"); my $cjar = HTTP::Cookies->new(file => "/root/perl/mediawiki/cookie +s/mediawiki.cookies", autosave => 1); my $client = LWP::UserAgent->new(default_headers => $header, cooki +e_jar => $cjar) || die "MWUser.pm LWP::UserAgent failed!\n"; my %login = ( 'action' => 'login', 'format' => 'xml', 'lgname' => 'user', 'lgpassword' => 'pass' ); my $r = $client->post($apiphp, Content=>\%login); while (my ($k, $v) = each (%$r)) { print "$k = $v\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent returns hash ref with post
by runrig (Abbot) on Apr 22, 2010 at 14:37 UTC | |
by halfcountplus (Hermit) on Apr 22, 2010 at 14:42 UTC | |
|
Re: LWP::UserAgent returns hash ref with post
by choroba (Cardinal) on Apr 22, 2010 at 14:32 UTC | |
by halfcountplus (Hermit) on Apr 22, 2010 at 14:38 UTC |