دالة PHP ftp_nb_get()

تعریف و استفاده

دالة ftp_nb_get() من FTP سرور فایل دریافت می‌کند و آن را به فایل محلی نوشته (بدون تأخیر).

This function returns the following values:

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

With ftp_get() Different, this function retrieves the file asynchronously. This means that your program can perform other operations while the file transfer is in progress.

Syntax

ftp_nb_get(ftp_connection,local,remote,mode,resume)
Parameters Description
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 to. If the file already exists, it will be overwritten.
remote Required. Specifies the path of the file to be copied from.
mode

Required. Specifies the transmission mode. Possible values include:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in the remote file. The default is 0.

Example

This example copies 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);
?>