473,473 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can Perl be used for this?

GC
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

Jul 19 '05 #1
2 2272
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);
Jul 19 '05 #2
GC
Are there more examples available somewhere?

Claus wrote:
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);


Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
31
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is...
41
by: Xah Lee | last post by:
here's another interesting algorithmic exercise, again from part of a larger program in the previous series. Here's the original Perl documentation: =pod merge($pairings) takes a list of...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
6
by: surfivor | last post by:
I may be involved in a data migration project involving databases and creating XML feeds. Our site is PHP based, so I imagine the team might suggest PHP, but I had a look at the PHP documentation...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
7
numberwhun
by: numberwhun | last post by:
**NOTE: This article is written using the 5.8.8 Alpha2 release of Strawberry Perl. I am writing this article with much joy and glee. This is due to the fact that Active State no longer has a...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.