Can Perl be used for this?

C

Claus

GC said:
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/atlantis/SilverStream/Pages/PM_GalileoLog.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);
 
G

GC

Are there more examples available somewhere?


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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top