Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Interpert/render JavaScript from a page

by xorl (Deacon)
on Sep 13, 2009 at 17:49 UTC ( [id://795011]=perlquestion: print w/replies, xml ) Need Help??

xorl has asked for the wisdom of the Perl Monks concerning the following question:

Hi fellow Monks,

I'm trying to figure out how I can get a webpage and render the JavaScript on that page and then take action based on what is rendered from the JS.

I've pretty much figured out how to get the webpage with LWP and some related modules. I haven't figured out how to make perl interpret the JavaScript on the pages. Can someone help me here?

Some background in case I'm doing this completely wrong. My friend wants a script that will log into his Belkin F5D7230-4 router and grab the WAN IP and then publish write that to a file on an external webserver he manages. He's not interested in using dyndns, whatsmyip.com or similar services.

I think I'm logging into the router correctly, but the index.html page is full of JavaScript that needs to be interpreted first before any meaningful information can be obtained.

So if there's a better way to get this guy's external IP address for him within the constraints provided, please let me know that too.

Thanks in advance.

  • Comment on Interpert/render JavaScript from a page

Replies are listed 'Best First'.
Re: Interpert/render JavaScript from a page
by Anonymous Monk on Sep 13, 2009 at 17:56 UTC
Re: Interpert/render JavaScript from a page
by Sewi (Friar) on Sep 13, 2009 at 21:24 UTC
    The easiest solution (if you have a webspace/server somewhere):
    #!/bin/sh echo "Content-type: text/plain" echo "" echo $REMOTE_ADDR
    Just call this CGI and it will tell you your IP address (at least if running on Apache).

    If you want to go at the router. I don't know this specific router, but many boxes support syslog. If you're able to run a syslogd and make it accept messages from the router (usually easy command line option), you always get the IP from the "connected" messages fresh on your hard disk.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2024-04-25 06:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found