in reply to Fetching Web Page and covert to text

What happens when you check the return of LWP::Simple::get() ?
use LWP::Simple; use HTML::TreeBuilder; use HTML::FormatText; print "Opening the URL"; $URL=get("http://www.yahoo.com/") || die "Couldn't fecth page"; $Format=HTML::FormatText->new; $TreeBuilder=HTML::TreeBuilder->new; $TreeBuilder->parse($URL); $Parsed=$Format->format($TreeBuilder); open FILE_OUT , '>D:\Profiles\in2228c\Desktop\info.txt'; print FILE_OUT "$Parsed"; close FILE_OUT; exit;

Replies are listed 'Best First'.
Re^2: Fetching Web Page and covert to text
by Ankit.11nov (Acolyte) on Jul 16, 2009 at 11:52 UTC
    Its giving the below error?
    Couldn't fecth page at open_url.pl line 6. Opening the URL
      It seems your problem is one of connectivity rather than your Perl, though for your own sanity use the following in your script also
      use strict; use warnings;
      Tested your script locally here and I get nicely formatted page out to the file.

      Perhaps the get-method is not the one you want to use?

      I don't know the three modules you are using, but more than one of them could have a get method.