in reply to Re: SpiderMonkey and JS
in thread SpiderMonkey and JS
The value comes back as undefined...Am I missing something else?use warnings; use strict; use LWP::UserAgent; use HTML::Parser; use JavaScript::SpiderMonkey; use Data::Dumper; my $base = 'http://www.myspace.com'; my $js = JavaScript::SpiderMonkey->new(); $js->init(); $js->function_set("SMSTokenValue", sub { print "@_\n"; }); $js->property_by_path("document.getElementById"); { my $ua = new LWP::UserAgent(); my $req = new HTTP::Request ('GET', $base); my $res = $ua->request($req); if (!($res->is_success)){ warn "Warning:".$res->message."\n"; } else { print "Successful\n"; $js->property_by_path("document.location.href"); my $rc = $js->eval(q! document.location.href = append("http://", "www.myspace.com"); document.getElementById = append("ctl00_ctl00_cpMain_cpMain_LoginB +ox_SMSVerifiedCookieToken"); SMSTokenValue("Token: ", document.getElementById); function append(first, second) { return first + ' = ' + second; } !); $js->destroy(); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: SpiderMonkey and JS
by spx2 (Deacon) on May 01, 2009 at 22:37 UTC |