PHP code example of pendenga / sftp

1. Go to this page and download the library: Download pendenga/sftp library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pendenga / sftp example snippets


// using example iniLoader to simplify (1 variable to look up)
$domo = new DomoPush(new IniLoader());
$domo->push($local_file, $domo->getRemoteFilename($domo_dataset_id));


// manual sftp operation (5 variables to look up)
$sftp = new SFTP($sftp_remote_path);
$rsa = new RSA();
$rsa->setPassword($rsa_password);
$rsa->loadKey(base64_decode($rsa_key_base64));
$sftp->login($sftp_username, $rsa);
$sftp->put($remote_file, $local_file, SFTP::SOURCE_LOCAL_FILE);