I nee开发者_高级运维d to do click a button within the admin side of my external website and cause it to trigger an application within my local workstation (with parameters based on button). I have full control of the server, PHP, etc. I can also install any application on my workstation. What is the best way to do this? Adobe AIR/Flash? Java?
I need something simple and I am open to all ideas.
You can launch the program from a signed java applet. Try something like this:
String cmd = "notepad.exe";
try {
Runtime rt;
rt = Runtime.getRuntime();
Process p = rt.exec( cmd );
System.out.println( "Exit Value = " + p.waitFor() );
} catch ( IOException e ) {
e.printStackTrace();
} catch ( InterruptedException e ) {
e.printStackTrace();
}
Probably the easiest thing to do is to use a protocol other than HTTP. For example, Apple uses webcal:// urls to open iCal and subscribe to calendars. Your application will get the URL passed to it, and you can do whatever you like based on the data in the URL.
Here's on article on how to do this with Mozilla:
https://developer.mozilla.org/en/web-based_protocol_handlers
You can Register an Application to a URL Protocol (Windows link given).
You could do this in Java by having a listener on your workstation watch for a file that an applet from the site admin writes to, but that could be hard.
Flash/AIR would be more of a pain if you don't already have Flash CS4 or later, but it might be easier if you do. I don't know of a way to communicate directly between Flash and AIR, but there's probably something out there.
精彩评论