I am trying to call a python script within a php script. However, I cannot seem to figure out how to pass an input through to the python script. The code I am using is as follows:
$input = '[{"item": "item1"}, {"item": "item2"}, {"item": "item3"}]';
$output = passthru("/usr/bin/python3.5 /path/python_script.py $input");
The output in python is a list that is created by splitting the string by spaces i.e. ' ' whilst removing the the quotation marks:
['/path/python_script.py', '[{item:', 'item1},', '{item:', 'item2},', '{item:', 'item3}]']
What would be the most straight-forward way to pass a json string through to python?