Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Fetching Web Page and covert to text

by Utilitarian (Vicar)
on Jul 16, 2009 at 11:37 UTC ( [id://780660]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://780660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-29 13:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found