We’re using Splunk (A tool to analyse machine data like log files) and have an application in PHP. For some data we need to do a call to our application in php (CLI-based). Unfortunately Splunk only supports Python calls.
Is there an easy way to 1:1 “forward/call” php with the same arguments and return the output, like a “passthru”. I’ve found only parts of the solution with the socalled subprocess module but my python experience is zero, so can’t get it to work.
For example, splunk calls:
python external_lookup.py argument1 argument2 argument3
– Then the python script should call (with the CLI arguments given to python):
php external_lookup.php argument1 argument2 argument3
– Then php writes its output
– Python captures that output and outputs it itself
Any help much appreciated, or a working example script even better.
Thanks in advance,
Vince
Using
subprocess.call:Edit: Made Python script return the value the PHP script returned.