Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: screen scraping

by Limbic~Region (Chancellor)
on Jan 08, 2005 at 19:37 UTC ( #420575=note: print w/replies, xml ) Need Help??


in reply to screen scraping

garskoci,
I also found that can not login in when using Mechanize.

What problem(s) are you having? Since WWW::Mechanize subclasses LWP::UserAgent, all the methods like credentials for doing authorization should work. So if that isn't it - what is?

Cheers - L~R

Replies are listed 'Best First'.
Re^2: screen scraping
by garskoci (Novice) on Jan 08, 2005 at 19:54 UTC
    Thanks for the response. I tried this bit here to log in. With different form names.
    $mech->get($url); $mech->form_name( 'FVS318'); $mech->field('id', $USER); $mech->field('p',$PASS); $mech->click('submit');
    But, this works. So, I can log in using the following.
    my $mech = LWP::UserAgent->new; $mech->credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' );
    I can get to the correct page, as I mentioned. So, now I will try to select and de-select the radio buttons. I have one example of selecting the radio buttons. I'll give it a whirl. Again, using the Perl modules and oo is totally new to me. Thank you.
      garskoci,
      Are the user and pass fields form values as the WWW::Mechanize example indicates, or are they more like HTTP basic auth like the LWP::UserAgent shows? I am just guessing, but what does the following code do?
      #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' ); # And then $mech->get() the same as in the LWP::UserAgent code
      FWIW, take a look at WWW::Mechanize::Shell as well.

      Cheers - L~R

      Update: Added a to autocheck

        I'm sorry, but like this? I get an error. Remember. Newbie. I am able to log in with the code that you provided.
        #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new( utocheck => 1 ); $mech->credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' ); # And then $mech->get() the same as in the LWP::UserAgent code my $mech->get(credentials( '192.168.0.1:80', 'FVS318', 'admin' => 'secret' );
        Thank you for your help. I will work on this tomorow. I am off to a wedding. Hopefully I can make some progress and post what I have.
        Thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://420575]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2023-01-31 14:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?