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!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Data From HTML Page

developer_pdeveloper_p Posts: 2Member
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.