in reply to A tool that logs and then parses the returned HTML.

Rather than using Win32::* modules, have a look at the Perl Library for WWW LWP, esp. the UserAgent, which can go out and get the HTML code for you in a much more portable and standard way.

Update: To log in with a login-id and password, you use the "credentials" (search in the docs of the UserAgent for "credentials"). There is a simple overloaded UserAgent which prompts you for the log-in and password: see LWP::AuthenAgent.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: A tool that logs and then parses the returned HTML.

Replies are listed 'Best First'.
Re: Re: A tool that logs and then parses the returned HTML.
by marynella (Novice) on Dec 23, 2003 at 12:46 UTC

        Thanks for the suggestion, but my script should log in without promting (the script will be sheduled to run in background once a day).

      In that case just use the basic UserAgent and provide the credentials in the script.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

        Thank! It works!
        #d:\Perl\bin\perl.exe use HTTP::Request::Common ; use LWP::UserAgent; use LWP 5.64; my $browser = LWP::UserAgent->new; $browser->credentials( 'www.mysite:port', 'real name', 'user' => 'passwd' ); my $url = 'http://www.site/mylogpage'; my $response = $browser->get($url); die "Error: ", $response->header('WWW-Authenticate') || 'Error accessing', # ('WWW-Authenticate' is the realm-name) "\n ", $response->status_line, "\n at $url\n Aborting" unless $response->is_success; $content = $response->as_string; some_function($content);