Hi Monks, I've been searching and trying to figure this out for a few days and have come to the conclusion that I don't know what the heck I'm doing. Can a girl get a little help? I need to access the "Students" > "Search for Sections" page of this website: https://admin8.gtc.edu/wa/wa I'm just on the first step... returning the contents of the page. I'll worry about following links after I've got this step done. I'm getting the error "Javascript is currently disabled." I thought JavaScript::SpiderMonkey would take care of that... but I guess I'm doing something wrong. Help?
#!/usr/bin/perl ###################################################################### +########## #these modules must be installed ###################################################################### +########## use JavaScript::SpiderMonkey; use LWP::UserAgent; ###################################################################### +########## #HTML headers included to make page show in browser ###################################################################### +########## print "HTTP/1.0 200 OK\n"; print "Content-Type: text/html\n\n\n"; ###################################################################### +########## #Enable javascript engine ###################################################################### +########## my $js = JavaScript::SpiderMonkey->new(); $js->init(); # Initialize Runtime/Context #Define a perl callback for a new JavaScript function $js->function_set("print_to_perl", sub { print "@_\n"; }); # Create a new (nested) object and a property $js->property_by_path("document.location.href"); # Execute some code my $rc = $js->eval(q! document.location.href = append("https://", "admin8.gtc.edu/wa/wa? +&TYPE=M&PID=CORE-WBMAIN&TOKENIDX=3292319802"); print_to_perl("URL is ", document.location.href); function append(first, second) { return first + second; } !); # Get the value of a property set in JS my $url = $js->property_get("document.location.href"); ###################################################################### +########## #Get page contents ###################################################################### +########## require HTTP::Request; my $req = new HTTP::Request('GET', $url); my $ua = new LWP::UserAgent; my $res = $ua->request($req); print $res->code."\n"; print "\n\n"; print $res->content; ###################################################################### +########## #Cleanup ###################################################################### +########## $js->destroy();

In reply to JavaScript and https page and contents by ShayShay

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.