i have problem , i want to passing variable from php to python . why if my word contains space , in python cannt receive this words . Example Code :
<?php
$variable = "Test Variable Contains Space";
echo shell_exec("C:\Users\HP\AppData\Local\Programs\Python\Python37-32\python.exe C:\Users\HP\AppData\Local\Programs\Python\Python37-32\hasil.py $variable ");
?>
in my python code :
import sys
variable = str(sys.argv[1])
print variable
the result i have from this code jut this words "Test" .
escapeshellargis usually the best option. Albeit cmd might mess with it, Python usually employs a standard shell argument tokenizer.