SPUG: Re: How to deal with pop-ups in automation

Richard Anderson richard at richard-anderson.org
Tue Feb 19 14:22:46 CST 2002

If you don't have a valid userid/password for the server you are accessing,
you are out of luck (unless you are a good cracker and are willing to risk
arrest and prosecution :-] ).

The way I handled this situation was to use CPAN modules LWP::UserAgent and
HTTP::Request::Common to create an HTTP user agent.  This allows you to pass
a userid and password with your request.  Here's a sketchy code outline:
use HTTP::Request::Common qw(GET POST);
use HTTP::Response qw(code content is_error status_line);
use LWP::UserAgent qw(agent request);
$request = POST($url, [ <hash containing parameters> ]);
$request->header('Content-type' => 'application/x-www-form-urlencoded');
$request->authorization_basic($test->{auth}->[0], $test->{auth}->[1]);
$response = $user_agent->request($request);

Some informational resources:
perldoc lwpcook
perldoc HTTP::Response
CPAN module HTTP::WebTest

richard at richard-anderson.org
----- Original Message -----
From: "S Bullo" <sweetsue at sweethomes.com>
To: "Seattle Perl User's Group" <spug-list at pm.org>
Sent: Tuesday, February 19, 2002 11:02 AM
Subject: SPUG: How to deal with pop-ups in automation

> Does anyone know how to get around or deal with automatic pop-ups when
> running a script?  I have one that inserts a bunch of information into a
> url, two items being a username and a password.  A site has been set up to
> use .htaccess and this, of course, causes a pop-up box to open for this
> information.  I'm not certain how to go about having my script "see" this
> and adjust accordingly.
> Any help is appreciated!
> Susanne Bullo

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list