title: How to download a file from SFTP using PHP?
body: <p>I am trying to download a file from an sftp server using php but I can't find any correct documentation to download a file.</p>
  
  <pre><code>&lt;?php 
  $strServer = "pass.com"; 
  $strServerPort = "22";
  $strServerUsername = "admin"; 
  $strServerPassword = "password";
  $resConnection = ssh2_connect($strServer, $strServerPort);
  if(ssh2_auth_password($resConnection, $strServerUsername, $strServerPassword)) {
      $resSFTP = ssh2_sftp($resConnection);
      echo "success";
  }
  ?&gt;
  </code></pre>
  
  <p>Once I have the SFTP connection open, what do I need to do to download a file?</p>