ftp_nb_fget
Download the file from the FTP server and save it to a locally opened file (non-blocking).
ftp_nb_fget()
function downloads a file from the FTP server and saves it to a locally opened file (non-blocking).
This function returns the following values:
Unlike ftp_fget()
, this function gets the file asynchronously. This means that your program can perform other actions when the file is downloaded.
This example copies the text from "source.txt" to "target.txt":
<?php $source = "source.txt" ; $target = fopen ( "target.txt" , "w" ) ; $conn = ftp_connect ( "ftp.testftp.com" ) or die ( "Could not connect" ) ; ftp_login ( $conn , "admin" , "ert456" ) ; ftp_nb_fget ( $conn , $target , $source , FTP_ASCII ) ; ftp_close ( $conn ) ; ?>
ftp_nb_fget ( 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. Specify local documents. |
remote | Required. Specifies the path to the file from which it is copied. |
mode |
Required. Specify transmission mode. Possible values are:
|
resume | Required. Specifies where to start copying in remote files. The default is 0. |