GC <gi****@hotmail.com> wrote in message news:<3F**************@hotmail.com>...
Hi,
I'm looking for a solution to capture the data on a web page with 2
buttons, send & receive threads of this URL
http://atlantis.b-rail.be:8880/atlan...alileoLog.html.
It would be nice to gather both pages and dump them into a MySql database.
Do you think Perl would be suitable for this and what's the direction I
need to take to build this script?
Geert
I use perl for this kind of stuff all the time. It's very simple.
use
LWP to handle the web interaction (see example below)
HTML::Form to deal with automatic form submission
DBI to deal with MySQL
Claus
Minimal LWP/HTML::Form example:
use strict;
use LWP::UserAgent;
use HTTP::Request;
use HTML::Form;
my $url = 'http://someurl';
#Setup your client - the UserAgent
my $ua = LWP::UserAgent->new;
# To be nice, set your agent string:
$ua->agent('LWP');
#This page uses GET
my $req = HTTP::Request->new(GET=>$url);
my $res = $ua->request($req);
if (not $res->is_success) {
die "no page found\n";
}
#Parse the result with HTML::Form
# You can set form values and also 'press buttons'
my $form = HTML::Form->parse($res->content, $url);
my $result = $ua->request($form->click);