in reply to Problem retrieving Web-page using LWP - help!
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use URI::URL; my $ua = new LWP::UserAgent; my $page = "http://lsa.colorado.edu/cgi-bin/LSA-sentence-x.html"; my $uri = new URI::URL; $uri->query_form("LSAspace" => "General_Reading_up_to_1st_year_college + (300 factors)", "LSAFactors" => "", "txt1" => "I hate Jimmy. I love Jimmy."); my $req = new HTTP::Request POST => $page; $req->content_type('application/x-www-form-urlencoded'); $req->content($uri->equery); my $res = $ua->request($req); if (!$res->is_success) { die "Fetch failed\n"; } my $content = $res->content; print $content;
|
|---|