Collaborate wrote:
On Dec 23, 3:34 pm, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
Collaborate wrote:
I am wondering if there is a way to copy a webpage to a text file using Perl.

     use LWP::Simple;
     my $url = 'http://www.example.com/';
     open my $fh, '>', 'webpage.txt' or die $!;
     print $fh get $url;

Thanks for your input. This is a really simple code to grab the html code and works great. Is there also a way to grab the text shown on the webpage rather than the html code?

I'm afraid I have nothing to add besides what Chas and others already have said on the topic.

For example, the text on pages that are javascript (such as Yahoo Finance stock quotes) do not show on the html code.

Obviously Yahoo don't want those pages to be scraped. If stock quotes is your area of interest, why don't you choose some other web site that provides similar info?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to