|
From: <php...@li...> - 2010-05-02 11:08:01
|
Hi,
isn't it possible to use the JSR 223 API to call your (external or
internal) PHP script methods?
Any PHP script which contains the call
java_call_with_continuation()
automatically implements the javax.script.Invocable interface. Example:
<?php //script.php
require_once("Java.inc");
...
java_call_with_continuation();
// reached after ((Closable)e).close() has been called
?>
main(String s[]) throws Throwable {
ScriptEngine e = new ScriptEngineManager().getEngineByName("php-invocable");
e.eval(new URLReader("http://localhost/drupal/script.php");
Invocable i = (Invocable)e;
System.out.println(i.invokeFunction("phpversion", new Object[]{}));
((Closeable)e).close();
}
You can append java_call_with_continuation() to a specific script or
to all scripts using the php.ini directive:
auto_prepend_file=JavaProxy.php
For internal scripts you can also use the RequestDispatcher to include
the PHP resource.
Please see
http://php-java-bridge.sourceforge.net/pjb/server/documentation/API/index.html
and
http://php-java-bridge.sourceforge.net/pjb/docs/php-api/JavaBridge/_JavaBridge.inc.html#functionjava_call_with_continuation
for details.
Regards,
Jost Bökemeier
|