Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Read web page Data

by thinker (Parson)
on Jul 20, 2003 at 08:26 UTC ( #276009=note: print w/ replies, xml ) Need Help??


in reply to Read web page Data

Hi AM,

When you ask for yahoo.com, what you will get is the default page for that site, maybe index.html, or index.cgi, or whatever. It doesn't really matter what it is called, it is just an html page.

In which case, simply change $file = "/path/to/savefile.txt" to $file = "/path/to/savefile.html"

Of course, hardcoding the filename in there is of limited use, unless you want to rename the file after each run of the program

I hope this is what you were asking :-)

cheers

thinker


Comment on Re: Read web page Data
Select or Download Code
Re: Re: Read web page Data
by Anonymous Monk on Jul 20, 2003 at 12:05 UTC
    This is wht I want to ask : I want to code a perl script as follows . Open Netscape and type a url . This url can be anything like perlmonks.com or yahoo.com or any url . Now I want my perl script to read data for this url . Suppose I type the url like yahoo.com then the perl script must be able to read data of that page . But if I change the url to rediff.com or any other then it should read that particular web page data. That means as I keep changing the url in Netscape the perl script should continue to read data for that url page and save it somewhere . Normally to retrieve web page data I use : $url = "http://www.myurl.com/ But my problem comes when I change the url in Netscape I am unable to change the url for the $url. Can u suggest me how can I achieve it .
      Look at a combination solution of autoit and perl. autoit can read your freshly type url and call your perl script with that url. It might be a bit complicated but will certainly work out if you put in the effort.
Re^2: Read web page Data
by Anonymous Monk on Jun 12, 2013 at 06:50 UTC
    Hi Monks, I also used code given here and I used following code as well but I did not get response: use strict; use warnings; use LWP::Simple; my $url = "http://www.google.com"; getprint($url); Windows7/perl 5.16.3 Can anyone please help me out here to extract data from any webpage. Thanks.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-12-26 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls