PHP ftp_ssl_connect()関数
例
安全なSSL-FTP接続を開きます。
<?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);
?>
定義と使用法
ftp_ssl_connect()関数は、安全なSSL-FTP接続を開きます。
接続が開いているときは、サーバーに対してFTP機能を実行できます。
注:この関数は、ftpモジュールとOpenSSLサポートの両方が静的にPHPに組み込まれている場合にのみ使用できます。
構文
ftp_ssl_connect(host, port, timeout);
パラメータ値
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 |
技術的な詳細
戻り値: | 成功した場合はSSL-FTPストリーム、失敗した場合はFALSE |
---|---|
PHPバージョン: | 4.3+ |
PHP変更ログ: | PHP 5.2.2-この関数は、非SSL接続にフォールバックする代わりに、SSL接続を使用できない場合にFALSEを返します。 |
❮PHPFTPリファレンス