Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Go here and download what you need: <a href="http://phpseclib.sourceforge.net/" rel="nofollow">http://phpseclib.sourceforge.net/</a></p> <p><strong><em>UPDATE</em></strong></p> <ul> <li><em>FOR SFTP</em></li> </ul> <p>Then in your script:</p> <pre><code>&lt;?php include('Net/SFTP.php'); $url = 'http://www.downloadsite.com'; $fileToDownload = "yourCSV.csv"; $cmd = "wget -q \"$url\" -O $fileToDownload"; exec($cmd); $sftp = new Net_SFTP('www.uploadsite.com'); if (!$sftp-&gt;login('username', 'password')) { exit('Login Failed'); } echo $sftp-&gt;pwd() . "\r\n"; $sftp-&gt;put('remote.file.csv', 'yourCSV.csv', NET_SFTP_LOCAL_FILE); print_r($sftp-&gt;nlist()); ?&gt; </code></pre> <p>If you need to connect to a second server for download:</p> <pre><code>$sftp2 = new Net_SFTP('www.serverFromWhichToDownload.com'); if (!$sftp2-&gt;login('username', 'password')) { exit('Login Failed'); } echo $sftp2-&gt;pwd() . "\r\n"; $sftp2-&gt;get('localFileName.csv', 'remoteFileName.csv'); print_r($sftp2-&gt;nlist()); </code></pre> <p>Read the docs for further help and examples: <a href="http://phpseclib.sourceforge.net/documentation/net.html#net_sftp_get" rel="nofollow">http://phpseclib.sourceforge.net/documentation/net.html#net_sftp_get</a></p> <p>To Log what your connection is doing if it fails, etc. use this:</p> <pre><code>include('Net/SSH2.php'); define('NET_SSH2_LOGGING', true); $ssh = new Net_SSH2('www.domain.tld'); $ssh-&gt;login('username','password'); echo $ssh-&gt;getLog(); </code></pre> <ul> <li><em>FOR FTP upload</em> - SO has gone crazy, does not want to format my code, but here it is anyway:</li> </ul> <pre> $file = 'somefile.txt'; $remote_file = 'readme.txt'; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { echo "successfully uploaded $file\n"; } else { echo "There was a problem while uploading $file\n"; } ftp_close($conn_id); </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload