I've create a script that execute some part from the php script by calling the 'request' GET,
Is there a way to execute the script via SHELL like this : php -q script.php?request
I've executed but nothing is happening.
Any help is appreciated
I've create a script that execute some part from the php script by calling the 'request' GET,
Is there a way to execute the script via SHELL like this : php -q script.php?request
I've executed but nothing is happening.
Any help is appreciated
you would typically place the arguments after the command:
php -q script.php request arg2
inside the file it would be read with
$request = $argv[1];
$arg2 = $argv[2];
($argv[0];)
is the script name
Edit
from the command line:
php -q script.php request
and inside script.php:
$request = $argv[1];
if(isset($request){
echo 'run this part';
}
Edit2
I suppose if the arguments are conditional you could do something like:
php -q script.php 'arg1:foo-arg2:bar'
and
$request = $argv[1];
$parts=explode('-',$request);
$args=array();
foreach($parts as $part){
$arg=explode(':',$part);
$args[$arg[0]]=$arg[1];
}
that would give you :
array(
arg1 => 'foo',
arg2 => 'bar'
)