php-doc-en/functions/ftp.sgml
cslawi 9256eb3b12 Normalized according to the DocBook 3.1 DTD. This mostly just adds
closing tags and attribute quotes, but lets a stock 3.1 install
compile the PHP docs. It still compiles with DocBook 3.0, as well.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@14693 c90b9560-bf6c-de11-be94-00142212c4b1
1999-10-20 22:41:42 +00:00

447 lines
15 KiB
Text

<reference id="ref.ftp">
<title>FTP functions</title>
<titleabbrev>FTP</titleabbrev>
<partintro>
<para>
FTP stands for File Transfer Protocol.</para>
<para>
The following constants are defined when using the FTP module:
FTP_ASCII, and
FTP_BINARY.</para>
</partintro>
<refentry id="function.ftp-connect">
<refnamediv>
<refname>ftp_connect</refname>
<refpurpose>Opens up an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_connect</function></funcdef>
<paramdef>string <parameter>host</parameter></paramdef>
<paramdef>int <parameter><optional>port</optional>
</parameter></paramdef>
</funcsynopsis>
<para>
Returns a FTP stream on success, false on error.</para>
<para>
<function>ftp_connect</function> opens up a FTP connection to the
specified <parameter>host</parameter>. The <parameter>port</parameter>
parameter specifies an alternate port to connect to. If it is
omitted or zero, then the default FTP port, 21, will be used.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-login">
<refnamediv>
<refname>ftp_login</refname>
<refpurpose>Logs in an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_login</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>username</parameter></paramdef>
<paramdef>string <parameter>password</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
Logs in the given FTP stream.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-pwd">
<refnamediv>
<refname>ftp_pwd</refname>
<refpurpose>Returns the current directory name</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_pwd</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
</funcsynopsis>
<para>
Returns the current directory, or false on error.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-cdup">
<refnamediv>
<refname>ftp_cdup</refname>
<refpurpose>Changes to the parent directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_cdup</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
Changes to the parent directory.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-chdir">
<refnamediv>
<refname>ftp_chdir</refname>
<refpurpose>Changes directories on a FTP server</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_chdir</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
Changes to the specified <parameter>directory</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-mkdir">
<refnamediv>
<refname>ftp_mkdir</refname>
<refpurpose>Creates a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>string <function>ftp_mkdir</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
Returns the newly created directory name on success, false on error.</para>
<para>
Creates the specified <parameter>directory</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-rmdir">
<refnamediv>
<refname>ftp_rmdir</refname>
<refpurpose>Removes a directory</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_rmdir</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
Removes the specified <parameter>directory</parameter>.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-nlist">
<refnamediv>
<refname>ftp_nlist</refname>
<refpurpose>Returns a list of files in the given directory.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_nlist</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
Returns an array of filenames on success, false on error.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-rawlist">
<refnamediv>
<refname>ftp_rawlist</refname>
<refpurpose>
Returns a detailed list of files in the given directory.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_rawlist</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcsynopsis>
<para>
<function>ftp_rawlist</function> executes the FTP LIST command,
and returns the result as an array. Each array element corresponds
to one line of text. The output is not parsed in any way. The
system type identifier returned by <function>ftp_systype</function>
can be used to determine how the results should be interpreted.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-systype">
<refnamediv>
<refname>ftp_systype</refname>
<refpurpose>
Returns the system type identifier of the remote FTP server.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_systype</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
</funcsynopsis>
<para>
Returns the remote system type, or false on error.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-pasv">
<refnamediv>
<refname>ftp_pasv</refname>
<refpurpose>Turns passive mode on or off.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_pasv</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>int <parameter>pasv</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_pasv</function> turns on passive mode if the
<parameter>pasv</parameter> parameter is true (it turns off
passive mode if <parameter>pasv</parameter> is false.) In
passive mode, data connections are initiated by the client,
rather than by the server.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-get">
<refnamediv>
<refname>ftp_get</refname>
<refpurpose>Downloads a file from the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_get</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>local_file</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
<paramdef>int <parameter>mode</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_get</function> retrieves <parameter>remote_file</parameter>
from the FTP server, and saves it to <parameter>local_file</parameter>
locally. The transfer <parameter>mode</parameter> specified must
be either FTP_ASCII or FTP_BINARY.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-fget">
<refnamediv>
<refname>ftp_fget</refname>
<refpurpose>Downloads a file from the FTP server and saves to an
open file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_fget</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>int <parameter>fp</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
<paramdef>int <parameter>mode</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_fget</function> retrieves <parameter>remote_file</parameter>
from the FTP server, and writes it to the given file pointer,
<parameter>fp</parameter>. The transfer <parameter>mode</parameter>
specified must be either FTP_ASCII or FTP_BINARY.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-put">
<refnamediv>
<refname>ftp_put</refname>
<refpurpose>Uploads a file to the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_put</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
<paramdef>string <parameter>local_file</parameter></paramdef>
<paramdef>int <parameter>mode</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_put</function> stores <parameter>local_file</parameter>
on the FTP server, as <parameter>remote_file</parameter>. The transfer
<parameter>mode</parameter> specified must be either FTP_ASCII or
FTP_BINARY.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-fput">
<refnamediv>
<refname>ftp_fput</refname>
<refpurpose>Uploads from an open file to the FTP server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_fput</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
<paramdef>int <parameter>fp</parameter></paramdef>
<paramdef>int <parameter>mode</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_fput</function> uploads the data from the file pointer
<parameter>fp</parameter> until end of file. The results are stored
in <parameter>remote_file</parameter> on the FTP server. The transfer
<parameter>mode</parameter> specified must be either FTP_ASCII or
FTP_BINARY.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-size">
<refnamediv>
<refname>ftp_size</refname>
<refpurpose>Returns the size of the given file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_size</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
</funcsynopsis>
<para>
Returns the file size on success, or -1 on error.</para>
<para>
<function>ftp_size</function> returns the size of a file. If an
error occurs, of if the file does not exist, -1 is returned. Not
all servers support this feature.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-mdtm">
<refnamediv>
<refname>ftp_mdtm</refname>
<refpurpose>Returns the last modified time of the given file.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_mdtm</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>remote_file</parameter></paramdef>
</funcsynopsis>
<para>
Returns a UNIX timestamp on success, or -1 on error.</para>
<para>
<function>ftp_mdtm</function> checks the last-modified time for a
file, and returns it as a UNIX timestamp. If an error occurs, or
the file does not exist, -1 is returned. Note that not all servers
support this feature.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-rename">
<refnamediv>
<refname>ftp_rename</refname>
<refpurpose>Renames a file on the ftp server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_rename</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>from</parameter></paramdef>
<paramdef>string <parameter>to</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_rename</function> renames the file specified
by <parameter>from</parameter> to the new name <parameter>to</parameter></para>
</refsect1>
</refentry>
<refentry id="function.ftp-delete">
<refnamediv>
<refname>ftp_delete</refname>
<refpurpose>Deletes a file on the ftp server.</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_delete</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
<paramdef>string <parameter>path</parameter></paramdef>
</funcsynopsis>
<para>
Returns true on success, false on error.</para>
<para>
<function>ftp_delete</function> deletes the file specified by
<parameter>path</parameter> from the FTP server.</para>
</refsect1>
</refentry>
<refentry id="function.ftp-quit">
<refnamediv>
<refname>ftp_quit</refname>
<refpurpose>Closes an FTP connection</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcdef>int <function>ftp_quit</function></funcdef>
<paramdef>int <parameter>ftp_stream</parameter></paramdef>
</funcsynopsis>
<para>
<function>ftp_connect</function> closes <parameter>ftp_stream</parameter>.</para>
</refsect1>
</refentry>
</reference>
<!-- 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
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->