yes it is possible, you can create a php wrapper that interacts with jsp. I recommend a http-request wrapper:
- your php script opens a stream to a iWeb jsp file with content sending by http-get
- the jsp fetch the get variable(s), do some action with this and then print something out to the stream
- php reads from the stream and interpret the output produced by jsp
Example Broadcast Wrapper:
broadcast.php
Code:
<?
$message = urlencode("Hello World");
$handle = fopen("http://localhost:8080/broadcast.jsp?message=$message", "r");
while($line = fgets($handle))
{
echo($line);
echo ("<br>");
}
fclose($handle);
?>
broadcast.jsp
Code:
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%
if(request.getParameter("message") != null)
{
String broadcast = request.getParameter("message");
if(protocol.DeliveryDB.broadcast((byte)9, -1, broadcast))
{
out.println("<font color=\"#00cc00\"><b>Message Send</b></font>");
}
else
{
out.println("<font color=\"#ee0000\"><b>Sending Message Failed</b></font>");
}
}
%>
Implement a security mechanism, or everyone can call the jsp with get command!
If you're confirm with php, you can create a function i.e. broadcast($message) that executes the code above, doing this for multiple functions will give you a nice php API...