CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Perl & LWP::Useragent Problem

 



ucs_met
New User

Jan 29, 2003, 6:17 AM

Post #1 of 7 (1570 views)
Perl & LWP::Useragent Problem Can't Post

Hello, somewhat new to LWP but have been using perl for a while. I am trying to automate the task of logging into my online banking website, and downloading all the checks for the month for processing. So far my script loads the webpage, fills in the form and clicks the submit button. After that i get a error 302 object moved. The output of my script with LWP::Debug + set.

What does 302 object moved mean. I have looked around on google and most people say that it has something to do with redirects. But LWP::UserAgent is suppose to handle redirects transparently i thought. Does anyone have any ideas.

LWP::UserAgent::new: ()
LWP::UserAgent::request: ()
LWP::UserAgent::send_request: POST https://ibs.secure-banking.com/cgi-bin/hb.exe
LWP::UserAgent::_need_proxy: Not proxied
LWP::UserAgent::send_request: https URLs are among LWP::UserAgent=HASH(0x804bf28)'s allowed protocols (http https)
LWP::Protocol::http::request: ()
LWP::Protocol::collect: read 187 bytes
LWP::Protocol::collect: read 100 bytes
LWP::UserAgent::request: Simple response: Found
<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</H1>
302 Object Moved
</BODY>
</HTML>


davorg
Thaumaturge / Moderator

Jan 29, 2003, 7:30 AM

Post #2 of 7 (1564 views)
Re: [ucs_met] Perl & LWP::Useragent Problem [In reply to] Can't Post

302 is an HTTP redirection status code.

It's hard to give you any more help without seeing your code.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks


ucs_met
New User

Jan 29, 2003, 9:20 AM

Post #3 of 7 (1560 views)
Re: [davorg] Perl & LWP::Useragent Problem [In reply to] Can't Post

Thanks for you help Dave, my code is pretty short.

I was think that maby the redirection problem, is because i copyied there form from there webpage that lets you login to there Banking Software and created this login.html file with only the form, to simplify what i was parsing.

my $ua = LWP::UserAgent->new;
my $url = 'http://*******/login.html';
my $html = get($url);
my $form = HTML::Form->parse($html, $url);

$ua->protocols_allowed(['http','https']);

$form->value("v1" => "*******"); #Banking Information
$form->value("v2" => "*******");

$ua->agent('GetChecks/0.1');
$response = $ua->request( $form->click);

if ($response->is_success) {
print $response->content; }
else {
print $response->error_as_HTML; }


ucs_met
New User

Jan 29, 2003, 10:07 AM

Post #4 of 7 (1557 views)
Re: [ucs_met] Perl & LWP::Useragent Problem [In reply to] Can't Post

Well, i have not gotton the script to work yet, but i have gotton past the 302 object moved error. After reading the perldoc on LWP::Useragent, i noticed that redirects where only allowed by default with 'GET' and 'Head', to add post i added this line of code, for anyone else who might have this problem.

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


mozkill
Novice

Mar 17, 2003, 12:57 PM

Post #5 of 7 (1529 views)
Re: [ucs_met] Perl & LWP::Useragent Problem [In reply to] Can't Post

i don't understand how you are accomplishing this without using Perl 5.6 Net-SSLeay ?? there is no such thing as accessing bank records without some kind of encryption... mabye that is your problem?


ucs_met
New User

Mar 17, 2003, 1:44 PM

Post #6 of 7 (1526 views)
Re: [mozkill] Perl & LWP::Useragent Problem [In reply to] Can't Post

I do have Crypt::SSLeay installed, is there any thing different between Net::SSLeay, and Crypt::SSLeay. Before i installed the Crypt::SSLeay modules, my script would return back No ssl support, after i installed the module, my script would return 302 object moved.


mozkill
Novice

Mar 21, 2003, 3:08 PM

Post #7 of 7 (1519 views)
Re: [ucs_met] Perl & LWP::Useragent Problem [In reply to] Can't Post

ahhh i see. well mabye if you using LWP, you can try using "simple_request" rather than "request" because "request" will automatically forward you when it gets a redirect and "simple_request" wont...

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives