http://www.perlmonks.org?node_id=416632


in reply to Re: Automatically fill out web forms from the command line
in thread Automatically fill out web forms from the command line

I just realized I can't get started because the first page is a Apache authenication/authorization page. I tried looking through Apache::Access for help, but I'm not sure this is the right track?
  • Comment on Re^2: Automatically fill out web forms from the command line

Replies are listed 'Best First'.
Re^3: How to authenticate / login htaccess with WWW::Mechanize
by davido (Cardinal) on Dec 21, 2004 at 22:23 UTC

    I posted about this a few weeks ago and bart helped me to find the answer. Here's an example snippet of how to authenticate an htaccess system with WWW::Mechanize:

    use strict; use warnings; use WWW::Mechanize; my $agent = WWW::Mechanize->new( autocheck => 1 ); $agent->credentials( 'www.somesite.com:80', 'somerealm', 'user', 'password' ); $agent->get( 'http://www.somesite.com/index.html' ); print $agent->content();

    It's important to use the port number in the credentials URL. The realm is also important to get right. You can usually see it as the title of the dialog box that pops up in your browser when you visit an htaccess-restricted site.


    Dave

Re^3: Automatically fill out web forms from the command line
by kutsu (Priest) on Dec 21, 2004 at 22:05 UTC

    If your set up through a proxy server you should be able to use $mech->proxy(['http'], 'http://user:pass@host:port/'); (port usually being 8080), which is documented in WWW::Mechanize POD. If not, I'm not sure and hopefully some other, wiser, monk will help you out.

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce