run script from shell and make it work..

hello there,
i am trying to run and make this little script from the linux shell but for some reason is always saying (no name)
how can I make it work and run?
if (isset($_REQUEST['name']) == 'bob') {
	echo 'Hello ' . htmlspecialchars($_POST["name"]) . '!';
	echo 'no name provided';

Open in new window

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

HackneyCabConnect With a Mentor Commented:
If you're running scripts from the command line, you want the following predefined variables instead of $_REQUEST,

$_SERVER['argc']    the number of parameters passed to the script on the command line

$_SERVER['argv']    an array of parameters passed to the script

So you should be able to change $_REQUEST['name'] to $_SERVER['argv'][0] (assuming the name value is the first parameter passed to the script).

See the relevant page in the PHP manual:
$_POST is only populated when run through a web-server. The variable is empty or non-existent when you run the script from shell.
All Courses

From novice to tech pro — start learning today.