Grateful_Dude has asked for the wisdom of the Perl Monks concerning the following question:
But I cannot POST the way it would seem I should be able too with this code: ----------------------------------------------use LWP::UserAgent; $ua = new LWP::UserAgent; $req = new HTTP::Request GET => 'http://www.sn.no/secret/'; $req->authorization_basic('aas', 'mypassword'); print $ua->request($req)->as_string; # the above code returns the html code for the form
I can manually login (basic authentication) to the site and POST data via the form, but I need to automate this...use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->credentials('user', 'password'); my $req = HTTP::Request::Common::POST($URL, [ 'txtUserID' => $USERID, 'txtPassword' => $PASSWORD, 'txtHeader' => $header, 'txtReportArea' => $data, 'onbtnSubmitReportWebEvent(btnSubmitReport)' => 'Submit Report +' ]); $req->authorization_basic('aas', 'mypassword'); print $req->status_line, "\n"; # the above returns 401 Access Denied
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: http POST + authentication
by Mr. Muskrat (Canon) on Dec 30, 2002 at 18:02 UTC | |
by CountZero (Bishop) on Dec 30, 2002 at 18:28 UTC | |
by Grateful_Dude (Acolyte) on Dec 30, 2002 at 19:30 UTC | |
by Grateful_Dude (Acolyte) on Jan 06, 2003 at 17:39 UTC | |
by JamesNC (Chaplain) on Dec 30, 2002 at 18:18 UTC | |
by Anonymous Monk on Dec 31, 2002 at 10:21 UTC | |
|
Re: http POST + authentication
by JamesNC (Chaplain) on Dec 30, 2002 at 17:30 UTC | |
by Aristotle (Chancellor) on Dec 30, 2002 at 19:13 UTC | |
by Grateful_Dude (Acolyte) on Dec 30, 2002 at 17:54 UTC | |
by fruiture (Curate) on Dec 30, 2002 at 18:20 UTC |