Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 3078

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>FTP functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Function Reference"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="fribidi_log2vis"
HREF="function.fribidi-log2vis.html"><LINK
REL="NEXT"
TITLE="ftp_cdup"
HREF="function.ftp-cdup.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.fribidi-log2vis.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.ftp-cdup.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.ftp"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>XXXIII. FTP functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN28198"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.intro"
></A
>Introduction</H1
><P
>&#13;     The functions in this extension implement client access to file
     servers speaking the File Transfer Protocol (FTP) as defined in 
     <A
HREF="http://www.faqs.org/rfcs/rfc959.html"
TARGET="_top"
>http://www.faqs.org/rfcs/rfc959.html</A
>.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.requirements"
></A
>Requirements</H1
><P
>No external libraries are needed to build this extension.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.installation"
></A
>Installation</H1
><P
>&#13;  In order to use FTP functions with your PHP configuration, you should
  add the <TT
CLASS="option"
>--enable-ftp</TT
> option when
  installing PHP 4 or <TT
CLASS="option"
>--with-ftp</TT
> when using
   PHP 3.
 </P
><P
> The windows version of <TT
CLASS="literal"
>PHP</TT
>
has built in support for this extension. You do not need to load any additional
extension in order to use these functions.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.configuration"
></A
>Runtime Configuration</H1
><P
>This extension has no configuration directives defined in <TT
CLASS="filename"
>php.ini</TT
>.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.resources"
></A
>Resource Types</H1
><P
>&#13;     This extension uses one resource type, which is the link identifier
     of the FTP connection, returned by <A
HREF="function.ftp-connect.html"
><B
CLASS="function"
>ftp_connect()</B
></A
>.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.constants"
></A
>Predefined Constants</H1
><P
>&#13;The constants below are defined by this extension, and
will only be available when the extension has either
been compiled into PHP or dynamically loaded at runtime.
</P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><TT
CLASS="constant"
><B
>FTP_ASCII</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_TEXT</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_BINARY</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_IMAGE</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_TIMEOUT_SEC</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     See <A
HREF="function.ftp-set-option.html"
><B
CLASS="function"
>ftp_set_option()</B
></A
> for information.
    </P
></DD
></DL
></DIV
><P
>&#13;  The following constants were introduced in PHP 4.3.0.
 </P
><P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><TT
CLASS="constant"
><B
>FTP_AUTOSEEK</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     See <A
HREF="function.ftp-set-option.html"
><B
CLASS="function"
>ftp_set_option()</B
></A
> for information.
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_AUTORESUME</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     Automatically determine resume position and start position for GET and PUT requests
     (only works if FTP_AUTOSEEK is enabled)
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_FAILED</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     Asynchronous transfer has failed
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_FINISHED</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     Asynchronous transfer has finished
    </P
></DD
><DT
><TT
CLASS="constant"
><B
>FTP_MOREDATA</B
></TT
> 
    (<A
HREF="language.types.integer.html"
>integer</A
>)</DT
><DD
><P
>&#13;     Asynchronous transfer is still active
    </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="ftp.examples"
></A
>Examples</H1
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN28292"
></A
><P
><B
>Example 1. FTP example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php
// set up basic connection
$conn_id = ftp_connect($ftp_server); 

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
        echo "FTP connection has failed!";
        echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
        exit; 
    } else {
        echo "Connected to $ftp_server, for user $ftp_user_name";
    }

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); 

// check upload status
if (!$upload) { 
        echo "FTP upload has failed!";
    } else {
        echo "Uploaded $source_file to $ftp_server as $destination_file";
    }

// close the FTP stream 
ftp_close($conn_id); 
?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="function.ftp-cdup.html"
>ftp_cdup</A
>&nbsp;--&nbsp;Changes to the parent directory</DT
><DT
><A
HREF="function.ftp-chdir.html"
>ftp_chdir</A
>&nbsp;--&nbsp;Changes directories on a FTP server</DT
><DT
><A
HREF="function.ftp-close.html"
>ftp_close</A
>&nbsp;--&nbsp;Closes an FTP connection</DT
><DT
><A
HREF="function.ftp-connect.html"
>ftp_connect</A
>&nbsp;--&nbsp;Opens an FTP connection</DT
><DT
><A
HREF="function.ftp-delete.html"
>ftp_delete</A
>&nbsp;--&nbsp;Deletes a file on the FTP server</DT
><DT
><A
HREF="function.ftp-exec.html"
>ftp_exec</A
>&nbsp;--&nbsp;Requests execution of a program on the FTP server</DT
><DT
><A
HREF="function.ftp-fget.html"
>ftp_fget</A
>&nbsp;--&nbsp;Downloads a file from the FTP server and saves to an open file</DT
><DT
><A
HREF="function.ftp-fput.html"
>ftp_fput</A
>&nbsp;--&nbsp;Uploads from an open file to the FTP server</DT
><DT
><A
HREF="function.ftp-get-option.html"
>ftp_get_option</A
>&nbsp;--&nbsp;Retrieves various runtime behaviours of the current FTP stream</DT
><DT
><A
HREF="function.ftp-get.html"
>ftp_get</A
>&nbsp;--&nbsp;Downloads a file from the FTP server</DT
><DT
><A
HREF="function.ftp-login.html"
>ftp_login</A
>&nbsp;--&nbsp;Logs in to an FTP connection</DT
><DT
><A
HREF="function.ftp-mdtm.html"
>ftp_mdtm</A
>&nbsp;--&nbsp;Returns the last modified time of the given file</DT
><DT
><A
HREF="function.ftp-mkdir.html"
>ftp_mkdir</A
>&nbsp;--&nbsp;Creates a directory</DT
><DT
><A
HREF="function.ftp-nb-continue.html"
>ftp_nb_continue</A
>&nbsp;--&nbsp;Continues retrieving/sending a file (non-blocking)</DT
><DT
><A
HREF="function.ftp-nb-fget.html"
>ftp_nb_fget</A
>&nbsp;--&nbsp;Retrieves a file from the FTP server and writes it to an open file (non-blocking)</DT
><DT
><A
HREF="function.ftp-nb-fput.html"
>ftp_nb_fput</A
>&nbsp;--&nbsp;Stores a file from an open file to the FTP server (non-blocking)</DT
><DT
><A
HREF="function.ftp-nb-get.html"
>ftp_nb_get</A
>&nbsp;--&nbsp;Retrieves a file from the FTP server and writes it to a local file (non-blocking)</DT
><DT
><A
HREF="function.ftp-nb-put.html"
>ftp_nb_put</A
>&nbsp;--&nbsp;Stores a file on the FTP server (non-blocking)</DT
><DT
><A
HREF="function.ftp-nlist.html"
>ftp_nlist</A
>&nbsp;--&nbsp;Returns a list of files in the given directory</DT
><DT
><A
HREF="function.ftp-pasv.html"
>ftp_pasv</A
>&nbsp;--&nbsp;Turns passive mode on or off</DT
><DT
><A
HREF="function.ftp-put.html"
>ftp_put</A
>&nbsp;--&nbsp;Uploads a file to the FTP server</DT
><DT
><A
HREF="function.ftp-pwd.html"
>ftp_pwd</A
>&nbsp;--&nbsp;Returns the current directory name</DT
><DT
><A
HREF="function.ftp-quit.html"
>ftp_quit</A
>&nbsp;--&nbsp;Closes an FTP connection</DT
><DT
><A
HREF="function.ftp-rawlist.html"
>ftp_rawlist</A
>&nbsp;--&nbsp;Returns a detailed list of files in the given directory</DT
><DT
><A
HREF="function.ftp-rename.html"
>ftp_rename</A
>&nbsp;--&nbsp;Renames a file on the FTP server</DT
><DT
><A
HREF="function.ftp-rmdir.html"
>ftp_rmdir</A
>&nbsp;--&nbsp;Removes a directory</DT
><DT
><A
HREF="function.ftp-set-option.html"
>ftp_set_option</A
>&nbsp;--&nbsp;Set miscellaneous runtime FTP options</DT
><DT
><A
HREF="function.ftp-site.html"
>ftp_site</A
>&nbsp;--&nbsp;Sends a SITE command to the server</DT
><DT
><A
HREF="function.ftp-size.html"
>ftp_size</A
>&nbsp;--&nbsp;Returns the size of the given file</DT
><DT
><A
HREF="function.ftp-ssl-connect.html"
>ftp_ssl_connect</A
>&nbsp;--&nbsp;Opens an Secure SSL-FTP connection</DT
><DT
><A
HREF="function.ftp-systype.html"
>ftp_systype</A
>&nbsp;--&nbsp;Returns the system type identifier of the remote FTP server</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.fribidi-log2vis.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.ftp-cdup.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>fribidi_log2vis</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ftp_cdup</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>