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

Re: Javascript in Perl and retrieving the HTML source.

by bassplayer (Monsignor)
on Sep 22, 2003 at 15:56 UTC ( #293165=note: print w/replies, xml ) Need Help??


in reply to Javascript in Perl and retrieving the HTML source.

Please include the code that you are using to retrieve the source code for this page. Including the code you have tried makes it much easier to assist you, and is always a good idea when posting on this site.

While parts of that table are affected by JavaScript, I do see the HTML for the table when I view the page source.

bassplayer

  • Comment on Re: Javascript in Perl and retrieving the HTML source.

Replies are listed 'Best First'.
Re: Re: Javascript in Perl and retrieving the HTML source.
by waiterm (Acolyte) on Sep 22, 2003 at 16:01 UTC
    code as follows
    open(HHOL, "C:/tmp/HHOL/HHOL.txt") || die ("unable to open HHOL file") +; while(my @HHOLid = split /=[^\n]*\n/, <HHOL>) { foreach $HHOLid (@HHOLid) { $src = "http://www.helpfulholidays.com/property.asp?ref=".$ +HHOLid."&year=".$year; sleep (rand 10); $_ = get($src); print ("$src\n"); } } }
    When I used this piece of code the table was excluded.
      Besides having an extra curly brace at the end, this code might not do what you had in mind. If there is indeed JavaScript that needs interpreting, then the JavaScript module that jeffa and sgifford suggested should do the trick. However, in the code above, you are printing the URL, not the source code. Are you sure the table in question is not being retrieved? What is the purpose of the file being opened?

      bassplayer

        Basically I need to grab the source and parse it to retrieve the availability (details in the table). When I run the print ($src); line it prints the basic html without the sections where Javascript is called, which is pretty much the section where the availability table is built into HTML. I'm pretty sure that the Javascript module should work but I know nothing about Javascript and how it works, so your advise is greatly appreciated.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2022-08-16 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?