http://qs321.pair.com?node_id=293165


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.