ftp_fget()

It downloads a file from the FTP server and saves to an open file

Example

<?php

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

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

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

ftp_fget($ftpId, $fp, “ftp.txt”, FTP_ASCII, 0) or die (“Failed”);

ftp_close($ftpId);

fclose($fp);

?>

Share