I am debugging a php script that will be called by a javascript function and that have POST arguments. I would like to test it in command line mode. I know it is possible doing it with the php -a option. But once in the interactive mode how to I set up the arguments? And how do I call my php? I can't neither remenber nor find how to do it.
My php script is:
<?php
$data = $_POST['string'];
$fname = $_POST['file'];
$dir=$_POST['dir'];
mkdir($dir);
$file = fopen($fname, 'w');
fwrite($file, $dir."\n");
fwrite($file, $data."\n");
fwrite($file, "/var/www/html/ChemAlive_app/SOFTWARE/utilities/"."\n");
fclose($file);
$saved = getenv("LD_LIBRARY_PATH"); // save old value
$newld = "/usr/local/NWChem/lib/"; // extra paths to add
if ($saved) { $newld .= ":$saved"; } // append old paths if any
putenv("LD_LIBRARY_PATH=$newld");
$saved = getenv("PATH"); // save old value
$newld = "/usr/local/NWChem/bin/"; // extra paths to add
if ($saved) { $newld .= ":$saved"; } // append old paths if any
putenv("PATH=$newld");
exec("cd $dir ; /var/www/html/ChemAlive_app/SOFTWARE/ChemAliveExec/ReactionThermo ".$fname);
?>
Thanks for your help.
curl. You can do it with PHP as well, but cURL via the console is more succinct.