PHP ftp_ssl_connect() Function
Definition and Usage
The ftp_ssl_connect() function opens a secure SSL-FTP connection.
When the connection is open, you can run FTP functions on the server.
Syntax
ftp_ssl_connect(host,port,timeout)
Parameter | Description |
---|---|
host |
Required. Specifies the FTP connection to be used (identifier for the FTP connection). It can be a domain name or an IP address. This parameter cannot contain "ftp://" or a slash. |
port | Optional. Specifies the port of the FTP server. The default is 21. |
timeout | Optional. Specifies the timeout for the FTP connection. The default is 90 seconds. |
Example
This example tries to connect to an FTP server. If the connection fails, the die() function will terminate the script execution and output a message:
<?php $conn = ftp_ssl_connect("ftp.testftp.com") or die("Could not connect"); ?>