develooper Front page | perl.beginners | Postings from January 2002

RE: How do I read a web page from within perl?

Thread Previous
From:
Hanson, Robert
Date:
January 30, 2002 07:07
Subject:
RE: How do I read a web page from within perl?
Message ID:
11A304418ECBAB498FBF10ABCEA5E499D1CD8D@hq2kax1.nj.aptegrity.com
If all you want to do is grab the text you could use the code below.  If you
also need to parse it you will need to look into using a parser as the other
mentioned.

use LWP::Simple;

my $html = get('http://www.cnn.com');

# If you need to split it into lines, this should work
my @lines = split(/\n/, $html);

Rob


-----Original Message-----
From: Collins, Joe (EDSI\BDR) [mailto:JCollins2@exchange.ml.com]
Sent: Wednesday, January 30, 2002 9:27 AM
To: 'beginners@perl.org'
Subject: How do I read a web page from within perl?



For example, suppose I want to capture www.cnn.com into an array
and process the text. How does one do this?

Many thanks,

Joe


-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About