Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Automate WebLogin

by Anonymous Monk
on Jan 21, 2011 at 16:14 UTC ( [id://883566]=note: print w/replies, xml ) Need Help??


in reply to Automate WebLogin

Wow, that javascript is just... wow.

From the looks of it, you can parse that with your eyeballs, and just hard code your script to submit the appropriate form info.

Replies are listed 'Best First'.
Re^2: Automate WebLogin
by Anonymous Monk on Jan 21, 2011 at 16:18 UTC
    But but but, that would make him a hacker!
Re^2: Automate WebLogin
by libvenus (Sexton) on Jan 21, 2011 at 18:07 UTC

    Yeah that is what i thought(parsing the javascript and hardcoding values).But, how do i hardcode the click:

    document.write("<td align=center colspan=2><input type=\"submit\" name +=\"btnSubmit\" value=\" OK \" onClick=\"if (setReqURL()==false) ret +urn false; if (checkCookiesAtField(userid)) return true; else return +false;\"></td>");
    Thanks,

      Learn what your browser sends, then send that from Perl. For example, using the Live HTTP Headers extension. Or learn Javascript and how it interacts with the HTML DOM, and what the click for a submit button does. Or just modify the code to find it out.

        Thanks for you help! I read the documentation of both JE and SpiderMonkey. Gave JE a shot but i m unable to proceed. Here is the code that i wrote to test JE:

        use strict; use warnings; use JE; use Data::Dumper; use File::Slurp; my $je = new JE; $je->html_mode(1); $je->eval(scalar read_file 'output.js'); my $return_val = $je->eval('start()') or die $@;

        The file output.js has the content of the javascript webpage that i want to parse.When i run the above script the JE failes with the follwing error:

        ReferenceError: The variable start has not been declared at line 1.

        Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-18 20:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found