|
I need to run an encryption function from php in the command line. i have the file encrypt.php:
$table = file('tblCandidate.txt');
$table = implode($table);
$table = blowfish_encrypt($table, 'encryption_password');
//now we have string stick in file
if (file_exists("to_send")) unlink("to_send");
$to_send = fopen("to_send", 'w');
fputs($to_send,$table);
fclose($to_send);
exit(0);
blowfish function is in the file also, not included for the sake of brevity.
i run the file (in windows) with:
C:\PHP\php -f c:\development\encrypt.php
What I want is to make the filenames (tblCandidate.txt & to_send) variables that are passed to the script from the command line, like:
C:\PHP\php -f c:\development\encrypt.php tblCandidate.txt to_send
Im pretty sure its possible, but not sure the format (from the command line or in the script).
Also, do we make filenames passed this way relative to script, or relative to where you call the script from?
Can anybody help me out? Cheers
|