This PHP class provides a simple wrapper for cURL functions to transfer ASCII files over FTP with implicit SSL/TLS.
- Connect to an FTP server over implicit SSL/TLS.
- Upload files to the FTP server.
- Get a list of files on the FTP server.
- Download files from the FTP server.
- Get the size of a remote file on the FTP server.
Instantiate the FTP_Implicit_SSL
class by providing the FTP server credentials:
$ftp = new FTP_Implicit_SSL($username, $password, $server, $port, $initial_path, $passive_mode);
Upload a file to the FTP server:
$ftp->upload($file_name, $file_content);
Retrieve a list of files on the FTP server:
$file_list = $ftp->ftpfilelist();
Download a file from the FTP server:
$ftp->download($file_name, $local_path);
Retrieve the size of a remote file on the FTP server:
$file_size = $ftp->remote_file_size($file_name);
Upload a file to the FTP server:
unset($ftp);
// Include the FTP class file
require_once('FTP_Implicit_SSL.php');
// Initialize FTP connection
$ftp = new FTP_Implicit_SSL($username, $password, $server, $port);
// Upload a file
$ftp->upload("example.txt", "This is a sample text file.");
// Get list of files
$file_list = $ftp->ftpfilelist();
print_r($file_list);
// Download a file
$ftp->download("example.txt", "./downloads/");
// Get remote file size
$file_size = $ftp->remote_file_size("example.txt");
echo "File size: $file_size bytes";
// Clean-up
unset($ftp);
- PHP 5.4 or higher
- cURL extension enabled
Feel free to contribute by submitting issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.