This code works for me:
#!/usr/bin/perl use strict; use HTTP::Request::Common; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); my $url = q{http://cgmix.uscg.mil/PSIX/VesselSearch.aspx}; my $req = GET $url; my $res = $ua->request($req); my ($key) = $res->content() =~ m{name="__VIEWSTATE" value="([^"]+)"}; $req = POST $url, Content_Type => 'application/x-www-form-urlencoded', Content => [ VesselName => 'FLINTHORN', VesselNumber => '', VesselCallSign => '', VesselHull => '', DropDownListFlag => 'ALL', DropDownListService => 'ALL', VesselYear => '', CheckBoxOutService => '', Submit1 => 'Search', __VIEWSTATE => $key, ]; $res = $ua->request($req); print $res->content(); __END__
As you can see Content_Type => 'form_data' is one of mistakes
In reply to Re^3: trouble talking to html form using LWP
by Gangabass
in thread trouble talking to html form using LWP
by mhearse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |