This is the scenario: I have a php script that builds html and echoes it to the browser. Just before html is echoed, I need to call executable java jar file and pass it the html so it could process it and return it back to php to be echoed out.
The only way I can come up with now is save html to temporary file, pass java the file name, let it modify it and load it again in php. I'm guessing this can be quite slow and requires file being written to disk, then read, modified, written again and read again.
My question is this: in given scenario is there a faster way of passing java the html file and returning it to php?
My current stack: Apache 2.4, PHP 5.4.7, Java 7, OS: Ubuntu