1. Go to this page and download the library: Download brick/ftp 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/ */
brick / ftp example snippets
use Brick\Ftp\FtpClient;
use Brick\Ftp\FtpException;
try {
$client = new FtpClient();
$host = 'ftp.example.com'; // FTP server host name
$port = 21; // FTP server port
$ssl = false; // whether to open a secure SSL connection
$timeout = 90; // timeout in seconds
$username = 'ftp-user';
$password = 'p@ssw0rd';
$client->connect($host, $port, $ssl, $timeout);
$client->login($username, $password);
// You usually want to set passive mode (PASV) on; see below for an explanation
$client->setPassive(true);
} catch (FtpException $e) {
// An error occurred!
}
echo $client->getWorkingDirectory(); // e.g. /home/ftp-user