I have a Python application (command line tool running on a machine M1) that has input I1 and output O2. Also, I have a PHP application (website running on a machine M2) that feeds the Python application with input I1 and expects to read the output O1. My question is what's the best approach to solve this problem? (the environment is GNU/Linux)
I was thinking at a solution with ssh; the PHP script executes a command via ssh: "ssh M2:./my_script.py arguments output_file" and transfers the output file "scp M2:output_file ." from M2 to M1. But, I don't think this solution is elegant. I was thinking of web services (the Python application should expose a web service), but I'm not sure what's the complexity of this solution or if it works.
Thanks,
I think you should implement a web service . I don't know how to do it with python but i suppose it would be fairly easy.
PHP and Python interfacing