PHP ftp_ssl_connect() Function

❮ PHP FTP Reference

Example

Open a secure SSL-FTP connection:

<?php
// set up basic SSL connection
$ftp_server = "123.123.123.123";
$ftp_conn = ftp_ssl_connect($ftp_server) or die("Could not connect to $ftp_server");

// login
$login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);

// then do something...

// close SSL connection
ftp_close($ftp_conn);
?>

Definition and Usage

The ftp_ssl_connect() function opens a secure SSL-FTP connection.

When the connection is open, you can run FTP functions against the server.

Note: This function is only available if both the ftp module and the OpenSSL support is built statically into PHP.

Syntax

ftp_ssl_connect(host, port, timeout);

Parameter Values

Parameter Description
host Required. Specifies the FTP server address. Can be a domain address or an IP address. This parameter should not be prefixed with "ftp://" or have any trailing slashes
port Optional. Specifies the port to connect to. Default is 21
timeout Optional. Specifies the timeout for network operations. Default is 90 seconds


Technical Details

Return Value: An SSL-FTP stream on success, FALSE on failure
PHP Version: 4.3+
PHP Changelog: PHP 5.2.2 - This function returns FALSE if it cannot use an SSL connection, instead of falling back to a non-SSL connection

❮ PHP FTP Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.