[MalaWiki] [TitleIndex] [WordIndex]

PowerBrowsingSlides/260 LWPUserAgent04

LWP::UserAgent - 04 - post form data

#!/usr/bin/perl -w
use strict;
use LWP 5.64;

my $word = shift;
$word or die "Usage: perl altavista_post.pl [keyword]\n";

my $browser = LWP::UserAgent->new;
my $url = 'http://www.altavista.com/web/results';

my $response = $browser->post( $url,
    [ 'q' => $word,  # the Altavista query string
      'pg' => 'q', 'avkw' => 'tgz', 'kl' => 'XX',
    ]
);

Remember

push @{ $ua->requests_redirectable }, 'POST';


2014-06-11 14:17