ftp_nb_fget()

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

Example

<?php

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

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

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

$dest = ftp_nb_fget($conn_id, $fp, “test.txt”, FTP_BINARY);

while ($dest == FTP_MOREDATA) {

  $dest = ftp_nb_continue($ftpId);

}

ftp_close($ftpId);

fclose($fp);

?>