Shell command not working via exec() in php -
i'm executing php function via php exec()
function seems pass through 1 variable @ time.
$url = "http://domain.co/test.php?phone=123&msg=testing" exec('wget '.$url);
within test.php file have
$msg = "msg =".$_get["msg"]." number=".$_get["phone"]; mail('me@gmail.com', 'working?', $msg);
i email returns phone variable only.
but if change url follows
$url = "http://domain.co/test.php?msg=testing&phone=123"
i msg
not phone
? ideas on causing strange behavior?
the &
sign special character in unix shell. need escape it:
exec("wget '$url'");
also, if url based on user input in way, careful escape escapeshellarg
. otherwise users able run arbitrary unix commands on server.
Comments
Post a Comment