Using Exec: pass an argument to be used as php var
Posted: Thu Jan 24, 2008 5:36 am
Consider the following code:
[If it is possible] I am trying to declare a var in PHP $arg (fine), pass it as an argument to an external program using exec (fine), and then pass that argument (represented as %1) as a var to an external PHP script (bombs).
By experimentation I can't get this to work. I would appreciate some advice.
Kind regards, Andrew
Code: Select all
<?PHP
$arg ='sometext';
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run("externalprogram.bat $arg", 7, false);
// contents of externalprogram.bat
//@C:\php\php.exe -q process.php?sometext=%1
?>
By experimentation I can't get this to work. I would appreciate some advice.
Kind regards, Andrew