I have a webpage that does a lot of processing in JavaScript and creates some nice tables/graphs/etc. I want to export this to Excel and have not found any PHP libraries that can handle charts, so I wrote a Java program using using Apachi’s POI library. Now the problem is, how can I send the JSON data to the Java program. Initially, I thought I could just send the JSON data in a POST request to a PHP page, then have PHP do a system call and pass the data on the command line. But 700,000 characters might be a bit too much for the command line. I looked into JSP and Servlets but have no experience with those (note my server doesn’t have this installed either). Any suggestions on how to send data directly to the Java program?
Update: I found out you can invoke method calls in a Java Applet from JavaScript. I think this will be the easiest way to use my existing Java program with minor modifications.
You don’t need to have JSP, one way of achieving this is writing a HTTP Servlet, drop it into a servlet container such as Tomcat, and have your PHP do a POST to the Servlet.
This opens a whole Java EE paradigm. ( :
Otherwise, you may check if PHP allows you to run command line batchs, which runs your Java program, then in your Java program output the results of the call to a text file or database, then have your PHP program read it.
No, 700k (600kb?) characters is not too much for a “command line”, i have seen batch jobs running on way more megabytes of data.