The ftp_ssl_connect() function is an inbuilt function in PHP which opens a secure SSL-FTP connection. FTP functions can be run against the server while the connection is open. It opens an explicit SSL-FTP connection to the host specified in parameter. It will succeed even if the server’s certificate is invalid or is not configured for SSL-FTP.
ftp_ssl_connect($host, $port, $timeout);
Parameters: This function accepts three parameters as mentioned above and described below:
- $host: It is required parameter. It specifies the FTP server address. It can be a domain address or an IP address. This parameter shouldn’t be prefixed with “ftp://” or shouldn’t have any trailing slashes.
- $port: It is an optional parameter. It specifies the port to connect to. If no port is provided then default port is used i.e. 21.
- $timeout: It is also an optional parameter. It specifies the timeout for network operations. If not provided then default value is passed which is 90 seconds.
Return Value: It returns SSL-FTP stream on success or false on failure.
- This function is available on PHP 4.0.0 and newer version.
- The following examples cannot be run on online IDE. So try to run in some PHP hosting server or localhost with proper ftp server name.
- This function is only available if both the ftp module and the OpenSSL support is built statically into PHP.
Below programs illustrate the ftp_ssl_connect() function in PHP:
Connection established successfully
Example 2: This example uses ftp_ssl_connect() function to logging in using SSL-FTP Connection
Successfully logged in with 126.96.36.199
- How to get the function name inside a function in PHP ?
- D3.js | d3.mean() function
- PHP | exp() Function
- PHP | Ds\Set xor() Function
- p5.js | abs() function
- p5.js | red() function
- D3.js zip() Function
- PHP | Ds\Map get() Function
- D3.js | d3.sum() function
- p5.js | hue() function
- D3.js | d3.map.set() Function
- CSS | rgb() Function
- p5.js | sq() function
- p5.js | pow() function
- p5.js | min() function
- CSS env() Function
- p5.js | day() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.