ftp_ssl_connect() function in PHP


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

Syntax

ftp_ssl_connect(host,port,timeout);

Parameters

  • host − The FTP server address. Can be a domain address or an IP address.

  • port − The port to connect to. Here the default is 21.

  • timeout − The timeout for network operations.

Return

The ftp_ssl_connect() function returns a SSL-FTP stream on success or FALSE on error.

Example

The following is an example −

<?php
   $ftp_server = "192.168.0.4";
   $ftp_user = "jacob";
   $ftp_pass = "tywg61gh";
   $ftp_conn = ftp_ssl_connect($ftp_server) or die("Could not connect to $ftp_server");
   $login = ftp_login($ftp_conn, $ftp_user, $ftp_pass);
   // close SSL connection
   ftp_close($ftp_conn);
?>

Updated on: 30-Jul-2019

225 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements