My problem :
I have a bash script on the server A, and a php script on another server, server B. The shell script on the server A was used to run the php script on the other server, but a few days ago one person put a bad rm -rf command on a wrong directory and deleted it. I had an old backup of this shell script but the code calling the php script on the second server is missing. These few lines (one line in fact, if I remember well) had been written by another person, some years ago, who does not work with us anymore and I can't contact her. I am not a php person and am quite new to this language, and after having searched for some tips on the web the last two days, without results, I decided to post here.
I am logged on the server A, as a user that can run the shell script. I have another couple of username/password used to log on the server B. This user can run the php script. Here's this php script :
<?php
/*
php -f invoke_manage_auto_requests_files.php "create|delete|upload" "vide|pre|res|obs" "nrcc|cgcm|arpege|crcm|rc|sta|md|mds" id "processing|nom du fichier"
eg . php -f invoke_manage_auto_requests_files.php create pre nrcc 15678 processing
*/
if($argv[1] == "upload") {
$argv[5] = '@' . realpath($argv[5]);
}
$post_fields = array( 'ACTION' => $argv[1] , 'PREFIX' => $argv[2] , 'REQ_TYPE' => $argv[3] , 'ID' => $argv[4] , 'FILE_CONTENT' => "$argv[5]");
$post_fields['VALIDATE'] = md5("This is legit");
$url = "http://serverB/scripts/manage_auto_requests_files.php";
$ch = curl_init($url);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS, $post_fields );
curl_exec($ch);
curl_close($ch);
?>
I am searching the way to call :
php -f invoke_manage_auto_requests_files.php create pre nrcc 15678 processing (for example)
But from the bash script. I only know that seems to be a curl call but i am not sure.
Here are the specifications of my servers :
Server A : PHP Version 4.4.4-8+etch6
System Linux hawa 2.6.26-bpo.2-686-bigmem #1 SMP Fri Jul 3 21:38:05 UTC 2009 i686
Server B : PHP Version 4.3.9
System Linux verglas 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:54:53 EST 2006 i686
Thanks for reading, or helping.