-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathftp-ssl-connect.xml
176 lines (169 loc) · 5.88 KB
/
ftp-ssl-connect.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 11a4d4964802dbc147f369b8a16df692c391cd2f Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi,mumumu -->
<refentry xml:id="function.ftp-ssl-connect" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>ftp_ssl_connect</refname>
<refpurpose>セキュアな SSL-FTP 接続をオープンする</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>FTP\Connection</type><type>false</type></type><methodname>ftp_ssl_connect</methodname>
<methodparam><type>string</type><parameter>hostname</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>port</parameter><initializer>21</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>timeout</parameter><initializer>90</initializer></methodparam>
</methodsynopsis>
<para>
<function>ftp_ssl_connect</function> は、指定した
<parameter>hostname</parameter> への<emphasis>明示的な</emphasis> SSL-FTP 接続をオープンします。
これは、サーバー側が SSL-FTP 接続に対応していなくても、
<function>ftp_ssl_connect</function> は成功するということです。
<function>ftp_login</function> をコールし、
クライアントが適切な <literal>AUTH FTP</literal> コマンドを送信した時点ではじめて、
<function>ftp_login</function> が失敗することになります。
<function>ftp_ssl_connect</function>
が確立する接続では、接続先の証明書の検証を<emphasis>行いません</emphasis>。
</para>
<note>
<title>この関数が存在しないことがあるのはなぜですか?</title>
<para>
PHP 7.0.0 より前のバージョンでは、
<function>ftp_ssl_connect</function> が使えるのは
ftp拡張モジュールと <link linkend="ref.openssl">OpenSSL</link> が静的に PHP に組み込まれている場合だけでした。
つまり、Windows 版の PHP 公式ビルドではこの関数は使えなかったということです。
この関数を Windows で使いたい場合は、PHP バイナリを自分でコンパイルしなければなりませんでした。
</para>
</note>
<note>
<para>
<function>ftp_ssl_connect</function> は、sFTP で使うための関数ではありません。
PHP で sFTP を使うには <function>ssh2_sftp</function> を参照ください。
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>hostname</parameter></term>
<listitem>
<para>
FTP サーバーのアドレス。このパラメータには、最後のスラッシュや
先頭の <literal>ftp://</literal> をつけてはいけません。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>port</parameter></term>
<listitem>
<para>
<parameter>port</parameter> パラメータは別のポートに接続することを
指定します。これを省略するか 0 にした場合、デフォルトの FTP ポート、
つまり 21 が使用されます。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>timeout</parameter></term>
<listitem>
<para>
このパラメータは、以降の全てのネットワーク処理の
タイムアウトを指定します。省略された場合の
デフォルト値は、90 秒となります。timeout は、
<function>ftp_set_option</function> および
<function>ftp_get_option</function>
でいつでも変更および取得可能です。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
成功した場合に <classname>FTP\Connection</classname>
クラスのインスタンスを返します。
&return.falseforfailure;
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.1.0</entry>
<entry>
<classname>FTP\Connection</classname>
クラスのインスタンスを返すようになりました。
これより前のバージョンでは、&resource; を返していました。
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>ftp_ssl_connect</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
// SSL 接続を確立する
$ftp = ftp_ssl_connect($ftp_server);
// ユーザー名とパスワードでログインする
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
if (!$login_result) {
// この場合は、すでに PHP 側で E_WARNING レベルのメッセージを発行しています。
die("can't login");
}
echo ftp_pwd($ftp);
// SSL 接続を閉じる
ftp_close($ftp);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>ftp_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->