1. Go to this page and download the library: Download kartulin/php-ftp-droid library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kartulin / php-ftp-droid example snippets
useKartulin\FtpDroid\FtpDroid;
// fast example
$ftp = FtpDroid::connect('127.0.0.1', $ssl = false, $port = 21, $timeout = 90)
->login('username', 'password')
->get($local_filename, $remote_filename, $mode = FTP_BINARY, $offset = 0)
->callback(function(FtpDroid $ftp){
if ($ftp->result){
// you logic here...//see $ftp->errors...
}
})->chdir($directory)
->close();
var_dump($ftp);
Kartulin\FtpDroid\FtpDroid {#3 ▼
+hostname: "127.0.0.1"
+ssl: false
+port: 21
+timeout: 90
-handler: FTP\Connection {#2}#logger: null
+result: true// the result of last method
+errors: array:1 [▼
1655710692 => "login"// [timestamp_error => "the name of the method that received the error from the ftp server"]
]