Andrei dela Cruz
Andrei dela Cruz

Reputation: 628

How to execute a page's javascript function in perl?

I am trying to extract data from a website using Perl. Below is the description of the site:

My question is, how do I execute that JS function so that I could loop through the dates that I need data from?

Thanks in Advance

Upvotes: 1

Views: 322

Answers (2)

gangabass
gangabass

Reputation: 10666

It's much easy make same HTTP request from your script and get all data you need directly.

You can record all HTTP requests/responses of your browser by using HTTP Fox extension (for Firefox).

Upvotes: 3

F. Hauri  - Give Up GitHub
F. Hauri - Give Up GitHub

Reputation: 70792

Edit

There is a CPAN module:

JavaScript - Perl extension for executing embedded JavaScript

But I've not already tested them.

Original post:

Take a look at smjs it's Spidermonkey's JS shell.

You could pass javascript by:

open my $jsout,"echo '$javascript' | smjs |" or die;
print <$jsout>;

...

But be care! This take security consideration away!

Upvotes: 2

Related Questions