package test;

import java.io.FileReader;

import javax.script.Invocable;

import php.java.script.PhpScriptEngine;

public class phptest {
  public static void main(String[] args) {
  	String l = "4";
	System.setProperty("php.java.bridge.default_log_level", l);
	System.setProperty("php.java.bridge.default_log_file", "");
	System.setProperty("php.java.bridge.php_exec", "php-cgi");

	try {
	    PhpScriptEngine engine = new PhpScriptEngine();

	    engine.eval(new FileReader("test/phptest.php"));
	    String name = (String) ((Invocable)engine).invoke("java_get_server_name", new Object[]{});
	    System.out.println("PHP/Java communication port: " + name);
		
	    engine.release();
	} catch (Exception e) {
	    e.printStackTrace();
	}
}

}
