I have a Java program, from which I need to call a PHP-written function in a separate file- how can I do this?
-
-
Answer:
A simple google search yielded this - http://stackoverflow.com/questions/614995/calling-php-from-java But IMHO, it is better to treat these services separately and provide well-defined interfaces, (say, REST like) so each side can call the other. With such interfaces, the languages used to implement the services don't matter since you can represent both success and failure cases, so the callers can take necessary actions. The services are loosely coupled, which would be a nice thing too.
Raghavendra Kidiyoor at Quora Visit the source
Other answers
If it's just one function in PHP then your best bet would be to port it to Java. The languages are fairly similar so unless it's a particularly hairy function it shouldn't be too difficult.
Paul Rothrock
The best answer is to port it. Writing it in Java will be faster in more reliable than creating a rest interface, shelling out, etc...
Nate Lyman
Related Q & A:
- How can I make a Spinner only by java?Best solution by stackoverflow.com
- How can I mount a network drive in Mac OS X in Java?Best solution by Stack Overflow
- How can I pass global variables into a function?Best solution by Stack Overflow
- How can I separate a video into two parts?Best solution by Yahoo! Answers
- I was trying to send a e-mail and it did not send how can i find it again.Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.