Current Location: Home> Function Categories> ftp_nb_get

ftp_nb_get

Download the file from the FTP server (non-blocking).
Name:ftp_nb_get
Category:Uncategorized
Programming Language:php
One-line Description:Download the file from the FTP server (non-blocking).

Definition and usage

The ftp_nb_get() function gets the file from the FTP server and writes it to the local file (non-blocking).

This function returns the following values:

  • FTP_FAILED (send/receive failed)
  • FTP_FINISHED (send/receive completed)
  • FTP_MOREDATA (send/receive in progress)

Unlike ftp_get() , this function gets the file asynchronously. This means that your program can perform other actions when file transfers.

Example

This example copies the text from "source.txt" to "target.txt":

 <?php
$conn = ftp_connect ( "ftp.testftp.com" ) or die ( "Could not connect" ) ;
ftp_login ( $conn , "admin" , "ert456" ) ;

ftp_nb_get ( $conn , "target.txt" , "source.txt" , FTP_ASCII ) ;

ftp_close ( $conn ) ;
?>

grammar

 ftp_nb_get ( ftp_connection , local , remote , mode , resume )
parameter describe
ftp_connection Required. Specifies the FTP connection to be used (the identifier of the FTP connection).
local Required. Specifies the local file to be written. If the file already exists, it will be overwritten.
remote Required. Specifies the path to the file from which it is copied.
mode

Required. Specify transmission mode. Possible values ​​are:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in remote files. The default is 0.
Similar Functions
Popular Articles