passing arguments

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ub007
Forum Newbie
Posts: 5
Joined: Sat Aug 30, 2008 4:14 pm

passing arguments

Post 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
ahowell
Forum Newbie
Posts: 17
Joined: Mon Sep 01, 2008 9:18 pm

Re: passing arguments

Post 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
 
Post Reply