Page 1 of 1

passing arguments

Posted: Mon Sep 01, 2008 3:53 pm
by ub007
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

Code: Select all

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:

Code: Select all

$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

Re: passing arguments

Posted: Tue Sep 02, 2008 12:29 pm
by ahowell
you need to put spaces between your arguments...

You have:

Code: Select all

$stream = ssh2_exec($con, 'python /home/leo/Desktop/pylo.py .$servername .$agents .$timeinterval .$ramp')
// python /home/leo/Desktop/pylo.pyhttp://www.example.com522
 
You need:

Code: Select all

$stream = ssh2_exec($con, "python /home/leo/Desktop/pylo.py {$servername} {$agents} {$timeinterval} {$ramp}");
// python /home/leo/Desktop/pylo.py http://www.example.com 5 2 2