PHP code example of rickmacgillis / sftp-and-ftp-client

1. Go to this page and download the library: Download rickmacgillis/sftp-and-ftp-client 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/ */

    

rickmacgillis / sftp-and-ftp-client example snippets


$ftp = new FtpClient();
$ftp->setHost($host);
$ftp->setPass($pass);
$ftp->setUser($user);
$ftp->setPort($port); // Defaults to port 21 if not explicitly set.
$ftp->setPassiveMode($passiveMode); // Set to true. (Defaults to false/active mode.)
$ftp->setTimeout($timeoutSeconds);
$ftp->setUseSsh(false);

$ftp->connect();

$ftp = new FtpClient();
$ftp->setHost($host);
$ftp->setPass($pass);
$ftp->setUser($user);
$ftp->setPort($port); // Defaults to port 22 if not explicitly set.
$ftp->setTimeout($timeoutSeconds);
$ftp->setUseSsh(true);