Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 697

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

<HTML
><HEAD
><TITLE
>ftp_nb_get</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Funciones FTP"
HREF="ref.ftp.html"><LINK
REL="PREVIOUS"
TITLE="ftp_nb_fput"
HREF="function.ftp-nb-fput.html"><LINK
REL="NEXT"
TITLE="ftp_nb_put"
HREF="function.ftp-nb-put.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
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"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.ftp-nb-fput.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.ftp-nb-put.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.ftp-nb-get"
></A
>ftp_nb_get</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN21844"
></A
><P
>    (PHP 4 &#62;= 4.3.0)</P
>ftp_nb_get&nbsp;--&nbsp;Retrieves a file from the FTP server and writes it to a local file (non-blocking)</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN21847"
></A
><H2
>Description</H2
>bool <B
CLASS="methodname"
>ftp_nb_get</B
> ( resource ftp_stream, string local_file, string remote_file, int mode [, int resumepos])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>ftp_nb_get()</B
> retrieves <TT
CLASS="parameter"
><I
>remote_file</I
></TT
>
     from the FTP server, and saves it to <TT
CLASS="parameter"
><I
>local_file</I
></TT
>
     locally. The transfer <TT
CLASS="parameter"
><I
>mode</I
></TT
> specified must
     be either <TT
CLASS="constant"
><B
>FTP_ASCII</B
></TT
> or
     <TT
CLASS="constant"
><B
>FTP_BINARY</B
></TT
>. The difference between this function and the
     <A
HREF="function.ftp-get.html"
><B
CLASS="function"
>ftp_get()</B
></A
> is that this function retrieves the file
     asynchronously, so your program can perform other operations while the
     file is being downloaded.
    </P
><P
>&#13;     Devuelve <TT
CLASS="constant"
><B
>TRUE</B
></TT
> si todo fue bien, <TT
CLASS="constant"
><B
>FALSE</B
></TT
> en caso de fallo.
    </P
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN21879"
></A
><P
><B
>Ejemplo 1. <B
CLASS="function"
>ftp_nb_get()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// Initate the download
$ret = ftp_nb_get($my_connection, "test", "README", FTP_BINARY);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo ".";

   // Continue downloading...
   $ret = ftp_nb_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo "There was an error downloading the file...";
   exit(1);
}</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN21883"
></A
><P
><B
>Ejemplo 2. Resuming a download with <B
CLASS="function"
>ftp_nb_get()</B
></B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// Initate 
$ret = ftp_nb_get ($my_connection, "test", "README", FTP_BINARY, 
                      filesize("test"));
// OR: $ret = ftp_nb_get ($my_connection, "test", "README", 
//                           FTP_BINARY, FTP_AUTORESUME);
while ($ret == FTP_MOREDATA) {
   
   // Do whatever you want
   echo ".";

   // Continue downloading...
   $ret = ftp_nb_continue ($my_connection);
}
if ($ret != FTP_FINISHED) {
   echo "There was an error downloading the file...";
   exit(1);
}</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN21887"
></A
><P
><B
>Ejemplo 3. 
       Resuming a download at position 100 to a new
       file with <B
CLASS="function"
>ftp_nb_get()</B
>
      </B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>// Disable Autoseek
ftp_set_option ($my_connection, FTP_AUTOSEEK, FALSE);

// Initiate
$ret = ftp_nb_get ($my_connection, "newfile", "README", FTP_BINARY, 100);
while ($ret == FTP_MOREDATA) {

   ...
   
   // Continue downloading...
   $ret = ftp_nb_continue ($my_connection);
}</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     In the example above, <TT
CLASS="filename"
>"newfile"</TT
> is 100
     bytes smaller than <TT
CLASS="filename"
>"README"</TT
> on the FTP
     server because we started reading at offset 100. If we have
     not have disabled <TT
CLASS="constant"
><B
>FTP_AUTOSEEK</B
></TT
>, the first
     100 bytes of newfile will be <TT
CLASS="literal"
>'\0'</TT
>.
    </P
><P
>&#13;     See also <A
HREF="function.ftp-nb-fget.html"
><B
CLASS="function"
>ftp_nb_fget()</B
></A
>, 
     <A
HREF="function.ftp-nb-continue.html"
><B
CLASS="function"
>ftp_nb_continue()</B
></A
>,
     <A
HREF="function.ftp-get.html"
><B
CLASS="function"
>ftp_get()</B
></A
> and <A
HREF="function.ftp-fget.html"
><B
CLASS="function"
>ftp_fget()</B
></A
>.
    </P
></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.ftp-nb-fput.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.ftp-nb-put.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ftp_nb_fput</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.ftp.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ftp_nb_put</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>