Hi Larry.

I saw the 'Larry W' and, just for a moment, thought we had
the man himself here!

Larry Wissink wrote:
> Hi,
> I'm a Perl newbie in way over my head, but I love a challenge.
> My company needs to download transaction data from a partner's
> website on a regular basis.  The data can be retrieved through a
> form, (entering date ranges, selecting merchants, etc.), but one must
> log in to the site first and must use Netscape 4.0 or IE 5.0 or
> higher.  I am trying to use LWP and related Perl modules to emulate a
> Netscape browser, login to the site and then fill out the form.
> Unfortunately, I just don't know enough about emulating a browser or
> secure transactions to do the job.  I am hoping someone out there can
> point me to some resources for learning more about these topics.
> Most of what I have been able to do comes from reading "Perl & LWP"
> by Sean M. Burke (O'Reilly Press).
> I include what I have managed to write, drawn heavily from the Burke
> book, for the edification (or amusement) of others.  Again, any
> insight will be greatly appreciated.
>
> Sincerely,
>
> Larry Wissink
> [EMAIL PROTECTED]
>
> This script retrieves the login page.  I pipe this to a file from the
> command line:
> c:\do_get.pl > befree_login.html
>
> #perl
> use strict;
> use LWP;
> use HTTP::Cookies;
> my $browser;

I guess seomthing went wrong in your post? Without knowing exactly
what you need to do I can only gieva  few pointers, all of which will
be in Sean's book anyway.

use LWP;
use HTTP::Request::Common;

will allow you to create a user agent and fetch a URL:

    my $ua = new LWP::UserAgent;
    my $url = 'http://host.com/path.page.htm';
    my $response = $ua->request (GET $url);

use HTML::TreeBuilder;

    will allow you to parse HTML. And look for useful bits.

my $tree = HTML::TreeBuilder->new_from_content($response->content);
my @forms = $tree->look_down(_tag => 'form');

use HTTP::Request::Form;

will let you fill in forms and press buttons:

      my $form = HTTP::Request::Form->new ($forms[0], $url);
      $form->field (username -> 'Larry');
      my $response = $ua->request ($form->press('login'));


There's obviously a lot more to it than that, such as
checking response status codes and so on, but it
should give you a pointer. If you need anything
further let us know more about what you're doing
and we'll do our best.

Cheers,

Rob




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to