how do i pass php variable to a python script on a different server

Viewed 33

This is how to pass php variables to python code in the same folder:

<?php
$var1 = "1";
$var2 = "2";
$var3 = "3";
#pass the variables to python
exec ( "python /path/to/python/script.py $var1 $var2 $var3" );
?>

Then in your Python script you can read them like this:

import sys

print sys.argv[1] # first parameter
print sys.argv[2] # second parameter
print sys.argv[3] # third parameter

But how do i do it if if the python script is located in i.e: https//:example.com/script.py ?

0 Answers
Related