Get server file time data failed, force after +1, still cannot download, please point out:
$host = ' ftp.mozilla.org ';
$user = ";
$password = ";
$remotefile = '/pub/mozilla.org/firefox/releases/30.0b7/linux-x86_64/en-us/firefox-30.0b7.tar.bz2 ';
$localfile = '/home/username/firefox-29.0.1.tar.bz2 ';
$conn = Ftp_connect ($host);
$remotetime = Ftp_mdtm ($conn, $localfile);
if (! ( $remotetime) >= 0) {
echo ' can\ ' t access remote file time.
';
$remotetime = $localtime +1;}
$fp = fopen ($localfile, ' w ');
if (! $success = Ftp_fget ($conn, $fp, $remotefile, ftp_binary)) {
echo ' error:could not download file ';
Ftp_quit ($conn);
------Solution--------------------
Do you have login FTP? Ftp_login ($conn, $user, $password);
------Solution--------------------
FTP is available for anonymous users
$url = ' ftp.mozilla.org ';
$ftp = Ftp_connect ($url); Connecting to an FTP server
Ftp_login ($ftp, ' Anonymous ', '); Sign in with an anonymous user
$list = Ftp_nlist ($ftp, '/'); Get the file list of the root directory
Print_r ($list);
Array
(
[0] =/readme
[1] =/index.html
[2] =/pub
)