reference/ftp/functions/ftp-fget.xml
4d1c34c9b7a30cfc3a59641122c707a2812cfed7
...
...
@@ -9,14 +9,14 @@
9
9
&reftitle.description;
10
10
<methodsynopsis>
11
11
<type>bool</type><methodname>ftp_fget</methodname>
12
-
<methodparam><type>resource</type><parameter>ftp_stream</parameter></methodparam>
13
-
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
14
-
<methodparam><type>string</type><parameter>remote_file</parameter></methodparam>
15
-
<methodparam><type>int</type><parameter>mode</parameter></methodparam>
16
-
<methodparam choice="opt"><type>int</type><parameter>resumepos</parameter><initializer>0</initializer></methodparam>
12
+
<methodparam><type>FTP\Connection</type><parameter>ftp</parameter></methodparam>
13
+
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
14
+
<methodparam><type>string</type><parameter>remote_filename</parameter></methodparam>
15
+
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>FTP_BINARY</constant></initializer></methodparam>
16
+
<methodparam choice="opt"><type>int</type><parameter>offset</parameter><initializer>0</initializer></methodparam>
17
17
</methodsynopsis>
18
18
<para>
19
-
<function>ftp_fget</function> retrieves <parameter>remote_file</parameter>
19
+
<function>ftp_fget</function> retrieves <parameter>remote_filename</parameter>
20
20
from the FTP server, and writes it to the given file pointer.
21
21
</para>
22
22
</refsect1>
...
...
@@ -25,15 +25,13 @@
25
25
<para>
26
26
<variablelist>
27
27
<varlistentry>
28
-
<term><parameter>ftp_stream</parameter></term>
28
+
<term><parameter>ftp</parameter></term>
29
29
<listitem>
30
-
<para>
31
-
The link identifier of the FTP connection.
32
-
</para>
30
+
&ftp.parameter.ftp;
33
31
</listitem>
34
32
</varlistentry>
35
33
<varlistentry>
36
-
<term><parameter>handle</parameter></term>
34
+
<term><parameter>stream</parameter></term>
37
35
<listitem>
38
36
<para>
39
37
An open file pointer in which we store the data.
...
...
@@ -41,7 +39,7 @@
41
39
</listitem>
42
40
</varlistentry>
43
41
<varlistentry>
44
-
<term><parameter>remote_file</parameter></term>
42
+
<term><parameter>remote_filename</parameter></term>
45
43
<listitem>
46
44
<para>
47
45
The remote file path.
...
...
@@ -58,7 +56,7 @@
58
56
</listitem>
59
57
</varlistentry>
60
58
<varlistentry>
61
-
<term><parameter>resumepos</parameter></term>
59
+
<term><parameter>offset</parameter></term>
62
60
<listitem>
63
61
<para>
64
62
The position in the remote file to start downloading from.
...
...
@@ -74,6 +72,31 @@
74
72
&return.success;
75
73
</para>
76
74
</refsect1>
75
+

76
+
<refsect1 role="changelog">
77
+
&reftitle.changelog;
78
+
<informaltable>
79
+
<tgroup cols="2">
80
+
<thead>
81
+
<row>
82
+
<entry>&Version;</entry>
83
+
<entry>&Description;</entry>
84
+
</row>
85
+
</thead>
86
+
<tbody>
87
+
&ftp.changelog.ftp-param;
88
+
<row>
89
+
<entry>7.3.0</entry>
90
+
<entry>
91
+
The <parameter>mode</parameter> parameter is now optional. Formerly it
92
+
has been mandatory.
93
+
</entry>
94
+
</row>
95
+
</tbody>
96
+
</tgroup>
97
+
</informaltable>
98
+
</refsect1>
99
+

77
100
<refsect1 role="examples">
78
101
&reftitle.examples;
79
102
<para>
...
...
@@ -91,20 +114,20 @@ $local_file = 'localfile.txt';
91
114
$handle = fopen($local_file, 'w');
92
115

93
116
// set up basic connection
94
-
$conn_id = ftp_connect($ftp_server);
117
+
$ftp = ftp_connect($ftp_server);
95
118

96
119
// login with username and password
97
-
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
120
+
$login_result = ftp_login($ftp, $ftp_user_name, $ftp_user_pass);
98
121

99
122
// try to download $remote_file and save it to $handle
100
-
if (ftp_fget($conn_id, $handle, $remote_file, FTP_ASCII, 0)) {
123
+
if (ftp_fget($ftp, $handle, $remote_file, FTP_ASCII, 0)) {
101
124
echo "successfully written to $local_file\n";
102
125
} else {
103
126
echo "There was a problem while downloading $remote_file to $local_file\n";
104
127
}
105
128

106
129
// close the connection and the file handler
107
-
ftp_close($conn_id);
130
+
ftp_close($ftp);
108
131
fclose($handle);
109
132
?>
110
133
]]>
...
...
@@ -112,29 +135,6 @@ fclose($handle);
112
135
</example>
113
136
</para>
114
137
</refsect1>
115
-
<refsect1 role="changelog">
116
-
&reftitle.changelog;
117
-
<para>
118
-
<informaltable>
119
-
<tgroup cols="2">
120
-
<thead>
121
-
<row>
122
-
<entry>&Version;</entry>
123
-
<entry>&Description;</entry>
124
-
</row>
125
-
</thead>
126
-
<tbody>
127
-
<row>
128
-
<entry>4.3.0</entry>
129
-
<entry>
130
-
<parameter>resumepos</parameter> was added.
131
-
</entry>
132
-
</row>
133
-
</tbody>
134
-
</tgroup>
135
-
</informaltable>
136
-
</para>
137
-
</refsect1>
138
138
<refsect1 role="seealso">
139
139
&reftitle.seealso;
140
140
<para>
...
...
@@ -146,7 +146,6 @@ fclose($handle);
146
146
</para>
147
147
</refsect1>
148
148
</refentry>
149
-

150
149
<!-- Keep this comment at the end of the file
151
150
Local variables:
152
151
mode: sgml
153
152