title: How to get result from a command executed in PHP on remote SSH server using PuTTY?
body: <p>I'm trying to execute a command on my Raspberry Pi via SSH and get the result of it in my PHP script on my Windows machine. Currently I can execute the command on my RasPi, but I do not get any results back into the PHP script.</p>
  
  <p>The code I'm Using for this:</p>
  
  <pre><code>&lt;?php
  
  $cmd = "C:\\path_to_putty\\putty.exe -ssh pi@RasPiIP -pw raspberry -m C:\\path_to_test.txt\\test.txt";
  $result = shell_exec($cmd);
  echo $result;
  
  ?&gt;
  </code></pre>
  
  <p>For sending commands to my RasPi the code works. I have tested multiple times by as example changing <code>test.txt</code> to <code>sudo reboot</code> and it worked as intended.
  I'm using PuTTY to send my command (<code>test.txt</code> is currently nfc-list which returns connected Scanners etc not important right here) to the RasPi.</p>
  
  <p>What I want to achieve is that <code>$result</code> contains the returned data when my command is executed.</p>
  
  <p>Is it even possible to do that? If yes how (any help appreciated). If no, are they maybe other ways to approach this?</p>
  
  <p>Addressing the possible duplicate: I am using a Windows Machine and also I'm trying to get the result (of the one command) to reuse in my PHP script. In the other question, user is trying to save the full console log and save it to another file.</p>