Skip to content

Simple class for cURL functions to transfer an ASCII file over FTP with implicit SSL/TLS

Notifications You must be signed in to change notification settings

nalindaDJ/php-FTP-implicit-ssl-tls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

FTP with Implicit SSL/TLS Class

This PHP class provides a simple wrapper for cURL functions to transfer ASCII files over FTP with implicit SSL/TLS.

Features

  • 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.

Usage

1. Initialization

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);

2. Upload a File

Upload a file to the FTP server:

$ftp->upload($file_name, $file_content);

3. Get List of Files

Retrieve a list of files on the FTP server:

$file_list = $ftp->ftpfilelist();

4. Download a File

Download a file from the FTP server:

$ftp->download($file_name, $local_path);

5. Get Remote File Size

Retrieve the size of a remote file on the FTP server:

$file_size = $ftp->remote_file_size($file_name);

6. Clean-up

Upload a file to the FTP server:

unset($ftp);

Example

// 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);

Requirements

  • PHP 5.4 or higher
  • cURL extension enabled

Contribution

Feel free to contribute by submitting issues or pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Simple class for cURL functions to transfer an ASCII file over FTP with implicit SSL/TLS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages