in reply to Howto fill in username and password in a popup cookie with Perl
I have a few thoughts. One is to enable cookies for Mech. That goes something like this:
If that and swapping those two lines isn't working, I do have one idea. I had a site I was scraping recently (with their permission), and I was having trouble getting Mech to log in. What eventually worked with was this:$mech->cookie_jar(HTTP::Cookies->new( file =>"mechcookies.txt", autosave => 1));
I think part of the trick was making sure that I was sending that username/password combination to the login-script. Though for all I know, once I was calling the get on that url, it was the credentials statement that made it work (logging-in with Mech is pretty new to me).my @args = (Authorization => "Basic " .MIME::Base64::encode('USER:PASS +')); $mech->get('https://www.BlahBlah.com/secure-bin/Blahclub/login_redirec +t.cgi', @args); $mech->get('http://www.BlahBlah.com/ThingIWant')
If you're having trouble locating the appropriate url for the login, I've had a lot of luck with Live HTTP Headers for Firefox, which basically tracks everything your browser does (when it's on), and has helped me mimic that with Mech. Good luck!
Hays
Update: Cookies may be on by default in Mech, but having the hard-copy lets you see what's there (if anything).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Howto fill in username and password in a popup cookie with Perl
by paulehr (Sexton) on Nov 15, 2006 at 02:13 UTC |