Data From HTML Page

Hi All,

I need to parse a web file such as

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 => '');
$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.



Sign In or Register to comment.

Howdy, Stranger!

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