1. Go to this page and download the library: Download spyric/ftpclient 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/ */
spyric / ftpclient example snippets
$ftp = new FTPClient();
$ftp->connect($host, $ssl, $port, $timeout);
$ftp->login($username, $password);
// This uses passive mode
$ftp->passive();
// If you want to disable using passive mode then
$ftp->passive(false);
// This uses binary mode, tandard is false
// You can use fullpath to change dir
$ftp->changeDirectory('/root_dir/sub_dir');
// or you can use method chaining
$ftp->changeDirectory('/root_dir')->changeDirectory('sub_dir');
$ftp->changeDirectory('/root_dir/sub_dir');
$ftp->parentDirectory(); // now we are in /root_dir
// will return current path as string
$ftp->getDirectory();
// creates a directory in current path
$ftp->createDirectory($directoryName);
$ftp->removeDirectory($directoryName);
// returns directory list as array
$ftp->listDirectory();
// executes the FTP LIST command, and returns the result as an array
$ftp->rawlistDirectory($parameters, $recursive);