Home  >  Article  >  Backend Development  >  ftp_ssl_connect() function in PHP

ftp_ssl_connect() function in PHP

王林
王林forward
2023-08-29 08:45:111391browse

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 − FTP server address. It can be a domain name address or an IP address.

  • #port − The port to connect to. The default is 21.

  • timeout − Timeout period for network operations.

Return value

The ftp_ssl_connect() function returns the SSL-FTP stream on success, and returns 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);
?>

The above is the detailed content of ftp_ssl_connect() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete