Dear All,
I have a java programming running well. Is it possible for me to invoke it from php programme? Thank you.
I imagine you’ll need the “bridge”, but here’s a good starting point PHP / Java Integration
Dear Mittie,
Is there any other solution beside this bridge. Thank you.
Do you need to invoke an external program written in Java or you want to somehow embed the Java code within PHP?
If it’s the former - www.php.net/system
Dear Blue,
I want to invoke an external program. The program will receive the phone number and send sms via gsm modem. So what is your best suggestion. Because this link http://php.net/manual/en/book.java.php is just on experimental basis. So is there any something which is more concrete. Thank you.
Did you code that external program? Can you pass parameters to the program somehow? Do you have ANY insight in how the program works when invoked from the command line? Is it a GUI-only program? Does it have any kind of API for accessing certain functions?
Knowing these things would help.
Dear Blue,
Yes I code the external program. No it is not a gui based program but just command line. Yes I can pass arguements to it. The external api is just the java communication library. Any other information you need?
You can use the [fphp]exec[/fphp] function to fire off another program and return its output.
Something like…
<?php
$os = exec('systeminfo | find "OS Name"');
echo $os; #OS Name: Microsoft Windows 7 Professional
?>
Dear Anthony,
How to fire my java program which resides in /usr/local folder? How to pass the arguements for it to work and at last to pass the arguement back to php too? Thank you.
The example I posted, does all of this. Check out the manual page for [fphp]exec[/fphp].
Dear Anthony,
Ok I will do the necessary then get back to you incase I am stuck. Thank you.