Passing variable through PHP exec

exec, php

Solution

Pass the argument:

exec('php email.php "' . addslashes($body) . '"');

Get it in email.php:

$body = stripslashes($argv[1]);

Problem

I am using the php `exec` command to execute another file. I am using the following: ``` exec ('php email.php'); ``` But I would wish to pass a variable called $body to "email.php" file through the exec command. How can I pass the variable through exec command?

Original source