I have the following Python code:
#!/usr/bin/env python
import sys
myargs = sys.argv[1]
mylist = ["foo bar qux", "uix nan col"]
for chunk in mylist:
mems = chunk.split()
mems.append(myargs)
print mems
When executed the following python test.py param giving this results:
['foo', 'bar', 'qux', 'param1']
['uix', 'nan', 'col', 'param1']
What I want to do is to use PHP to call the above python script and parse the output. I have this in my php code (index.php):
<HTML>
<HEAD>
<TITLE>MYCODE</TITLE>
</HEAD>
<BODY>
<BR>
<?php echo '<p>This is the output of my code:</p>'; ?>
<?php
$vars = eval(`python /misc/path_to_mycode/test.py param1`);
var_dump($vars)
?>
</BODY>
</HTML>
But it prints this instead over the web:
