Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm fairly new to this so please be patient. I'm trying to log in to a site which requires a login and a pw. I think this part works. The problem I have is that once I submit the form, the next page seems to not work anymore. Using lynx it tells me that the link I want to follow (registration) is a form submit button. It seems to connect to the correct site but doesn't find any buttons there - lynx once again finds another form submitt button (just an ok on a verification screen) Am I missing anything ?!?
use LWP; use HTTP::Request::Common; use WWW::Mechanize; my $url="https://student.access.fsu.edu/Index/"; $browser->get($url); #Log in to this page $browser->field('SSN',$user); $browser->field('PIN',$password); $browser->submit_form(form_number=>0); if( !$browser->success()) {print "!!!error!!!";} #if not submitted -er +ror! $browser->submit_form(form_number=>1); #click button i.e OK #This is where I can't seem to find the form submit button I have when + using lynx print $browser->uri(); #correctly https://student.access.fsu.edu/SecureScripts/WebEncore.dll? +OldWebLink.html print $browser->content();
Thanks for any help!!

Replies are listed 'Best First'.
Re: www login problem
by sgifford (Prior) on Nov 08, 2003 at 20:49 UTC

    If you can't get it to work in Lynx, you're not going to be able to get it to work from Perl.

    Some possibilities

    • It requires Javascript to use, in which case you're pretty close to screwed
    • It requires cookies, which are disabled in your copy of Lynx, in which case you just have to enable them in Lynx and in your Perl program.
    • It's doing some kind of browser detection, in which case you'll have to make your Perl script lie about what kind of browser it is.

    If it works from another browser, like Mozilla, I would recommend using a packet sniffer to see exactly what's going on, then see how what your script is doing is different.

      Thanks for the info! Just some more info: it works just fine using lynx: I have to links(both consider form submits) and the 2nd is the one I want. When I look at the page info it has one form:'login' with two fields 'clear' and 'ok' - both submit type. print " $browser->form()";yields  WWW::Mechanize=HASH(0x1014345c)->form() and $browser->form_name("login"); yields There is no form named "login" at ./test It also wont let me do clicks yet lynx is perfectly happy!?!?