ub007 Posted September 1, 2008 Share Posted September 1, 2008 Hi, I got a python program that runs with the foll arguments python load.py http://www.example.com 5 2 2 i supply the 4 args through this form SERVER(enter in the format 'www.example.com'): <input type="text" name="server" /><br /> AGENT: <input type="text" name="threads" /><br /> INTERVAL: <input type="text" name="interval" /><br /> RAMPUP: <input type="text" name="rampup" /><br /> i get the values here: $servername = $_GET['server']; $agents = $_GET['threads']; $timeinterval = $_GET['interval']; $ramp = $_GET['rampup']; $stream = ssh2_exec($con, 'python /home/leo/Desktop/pylo.py .$servername .$agents .$timeinterval .$ramp') This doesnt work sometimes theres no output and when i fiddle around with the spaces or commas i get parse error, unexpected T_CONSTANT_ENCAPSED_STRING, something like $stream = ssh2_exec($con, 'python /home/leo/Desktop/hello.py) runs perfectly fine PLz help Link to comment https://forums.phpfreaks.com/topic/122283-passing-arguments/ Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 Is the form's method set to GET? If it is set to POST, use $_POST to catch the values. EDIT: Hmm ok, probably i got this wrong. But why you're using python anyway? Link to comment https://forums.phpfreaks.com/topic/122283-passing-arguments/#findComment-631434 Share on other sites More sharing options...
Fadion Posted September 1, 2008 Share Posted September 1, 2008 Just noticed this: $stream = ssh2_exec($con, 'python /home/leo/Desktop/pylo.py .$servername .$agents .$timeinterval .$ramp') that should be: $stream = ssh2_exec($con, "python /home/leo/Desktop/pylo.py $servername $agents $timeinterval $ramp") Variables return their values only in double quotes, not in single ones and there's no need to concatenate variables which are inside quotes. To give the idea: <?php $site = 'phpfreaks'; echo 'This site is: $site'; //will print: This site is: $site echo "This site is: $site"; //will print: This site is: phpfreaks echo "This site is: . $site"; //will print: This site is: . phpfreaks echo 'This site is:' . $site; //will print: This site is: phpfreaks ?> Link to comment https://forums.phpfreaks.com/topic/122283-passing-arguments/#findComment-631501 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.