Re: How do I process a webpage
- I'm going to describe how to get a page from a web site. Apologies if
this is not the part you are stuck on.
my ( $ua, $request, $response );
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new( GET => 'http://www.d.com/index.html' );
$response = $ua->request( $request );
# Display the returned data.
print "Content:\n" . $response->content if ( $response->code == 200
# This crude code removes the HTML tags, leaving the basic text.
# my $HTMLContent = $response->content;
# $HTMLContent =~ s/<.*?>//g;
# print "\n\n$HTMLContent";
This is a very simple example. You can assign the returned content
($response->content) to a variable (like in the commented out code at
the end) and then parse it as you need.
--- In perl-beginner@y..., slavik944@m... wrote:
> Hello once again all, I have been assigned a project at work that
> requires the following.
> Access a webpage and gather the data from it. From what I
> the program that I will be creating will access the webpage in
> question via conventional methods. In other words, I dont ftp to
> server and download the page itself. I have to access it via a web
> So the reason I'm contacting this list is to ask to be pointed in
> right direction as to where I should look to do this. Also, if
> has any useful input regarding this matter I would like to hear it.
> Steve M