Data From HTML Page - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Data From HTML Page

developer_pdeveloper_p Posts: 2Member
Hi All,

I need to parse a web file such as
http://www.abc.com/place/abc.cgi

I need to get data from this file using PERL.
Any help or pointers on this will be of great help.

The link also requires user name name and password.
For user name as password the following code works.

#!/usr/bin/perl -w

use LWP::UserAgent;
use HTML::TreeBuilder;

# Prepare request.
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request(GET => 'http://www.abc.com/plac/abc.cgi');
$req->authorization_basic("username", "password");




# Request file.
my $res = $ua->request($req);
print $res;



# Check if request was successful.
if ($res->is_success) {

my $file = $response->content;
do stuff with file
} else {
die $res->status_line;
}



Now after this i want ot read the data from the page.
The page contains data as:
Name Place ID Location

I want to parse Name.

Please provide your valuable input on this.


Regards
developer_p


Comments

Sign In or Register to comment.