Click to See Complete Forum and Search --> : Perl script to read JavaScript
threadhead
10-08-2007, 04:12 AM
Hello there,
i would like to know if there is any way for a perl script to read data that is saved in a javascript applet. suppose we have a text box with as an applet that says "hey there" ;). is it possible to read the text inside the applet with perl?
Or is it possible to convert the applet to any other form that is readable with perl?
thanks in advance
cheers threadhead
bwkaz
10-08-2007, 06:10 PM
Javascript applet? Huh?
Perhaps you mean "Javascript script"? If so, then you can pull the .js file and look at its contents in Perl, yes. You might even be able to write a Javascript interpreter that would run it (if that's what you end up needing to do).
Or perhaps you mean "Java applet". If so, you can (also) pull the .class file and look at its contents using Perl. Assuming you're looking for the printable strings, you'd have some filtering to do because of the structure of a .class file. (Or you could just shell out to the OS strings binary.)
In other words, Perl can open any file you want...
threadhead
10-09-2007, 10:26 AM
Or perhaps you mean "Java applet". If so, you can (also) pull the .class file and look at its contents using Perl. Assuming you're looking for the printable strings, you'd have some filtering to do because of the structure of a .class file. (Or you could just shell out to the OS strings binary.)
In other words, Perl can open any file you want...
Hey bwkaz, I mean a "Java Applet", and the string example wasn't very well chosen. In fact I need to read a table, like in Excel, which is displayed via a Java Applet.
I already took a look at the .class file, but there I couldn't find anything useful.
Yesterday I saw a plugin named Java::Import for Perl and it seems to be able to use a .class file for method invocation.
Have you heard of it?
Best Regards threadhead
bwkaz
10-09-2007, 06:43 PM
Huh? "read a table ... which is displayed via a Java applet" -- what's that supposed to mean? How does a Java applet display something specifically as a table? AFAIK, the only thing a Java applet can do is display some basic UI inside the browser; if the issue is that it's displaying a grid with data in it, then you can't (easily) scrape that with any language, really.
Now, if you run Java on the web server, you can serve up a web page with HTML <table> tags. You can pull that down from inside Perl (though I don't know how) and process the table(s), if that's what you mean...
threadhead
10-10-2007, 11:57 AM
if the issue is that it's displaying a grid with data in it, then you can't (easily) scrape that with any language, really.
It is like you said above. Well, I have access to the .class file but it's not my own webserver. What I would like to do is to spider a complete domain that holds very many java applets, that are programmed like a table with grid.
Inside the html file it looks like this
<applet code='grafic.class' codebase='java' width='450' height='300'>
<param name='param1' value="val1">
<param name='param2 value="value2">
<param name='param3' value="valu3">
Is there a way to call the methods of the .class file locally?
Best Regards threadhead
bwkaz
10-10-2007, 07:00 PM
Is there a way to call the methods of the .class file locally? Probably, if you write a "wrapper" Java program to load in the .class file and call the method(s).
If you want to do it from Perl, then that Import::Java package sounds like it might possibly work, although I've never used it myself. You'd have to know the parameter list for the function(s) you're going to call, though.