ftp_nb_get()

It retrieves a file from the FTP server and writes it to a local file

Example

<?php

$fp = fopen(“test.txt”, ‘w’);

$ftpId = ftp_connect(‘ftp.phpcodez.com’);

$login = ftp_login($ftpId, ‘anonymous’, ‘user@phpcodez.com’);

$ret = ftp_nb_get($ftpId, $fp, “test”, FTP_BINARY, filesize(“test”));

while ($dest == FTP_MOREDATA) {

  $dest = ftp_nb_continue($ftpId);

}

  ftp_close($ftpId);

  fclose($fp);

?>

Share