title: Send data between two remote servers with popen, fgets and ssh
body: <p>I try to communicate two machines by ssh and pipe to get a message from one to another. 
  The second reads the message form the first machine with sdtin and writing in text file.</p>
  
  <p>I have a machine where I have this program but it's doesn't work...</p>
  
  <pre><code>$message = "Hello Boy";
  $action = ('ssh root@machineTwo script.php'); 
  $handle = popen($action, 'w');
  
  if($handle){
     echo $message;
     pclose($handle);
  }
  </code></pre>
  
  <p>On the other machine, machineTwo i have :</p>
  
  <pre><code> $filename = "test.txt";    
       if(!$fd = fopen($filename, "w");
       echo "error";
          }
       else {
              $action = fgets(STDIN);
              fwrite($fd, $action);
      /*On ferme le fichier*/
      fclose($fd);}
  </code></pre>