$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 ';
Reply to discussion (solution)
Var_dump ($remotetime);
See what you got.
Do you have login FTP? Ftp_login ($conn, $user, $password);
Do you have login FTP? Ftp_login ($conn, $user, $password);
$result = @ftp_login ($conn, $user, $password);
if (! $result) {
echo "Error:could not log on as $user
";
Ftp_quit ($conn);
Exit
}
Yes, but login failed. How do I write this user name and password? Firefox does not require a user name and password for FTP download, but ftp_login requires a username and password. I do not know how to do, please point out, in Oschina questions they did not talk to me, it may be that the problem is too low.
Var_dump ($remotetime);
See what you got.
Unable to log on using Ftp_login. Firefox does not require a user name and password for FTP download, but the Ftp_login function requires a username and password. I do not know how to do, please point out, in Oschina questions they did not talk to me, it may be that the problem is too low.
and the browser does not matter, it is the browser remember.
FTP is available for anonymous users
$url = ' ftp.mozilla.org '; $ftp = Ftp_connect ($url); Connect the FTP server Ftp_login ($ftp, ' Anonymous ', '); Login with anonymous user $list = Ftp_nlist ($ftp, '/'); Get the root directory file list print_r ($list);
Array ( [0] =/readme [1] =/index.html [2] =/pub)
If you know the directory structure of FTP, you can use the
File_get_contents Read
File_put_contents Write
If you know the directory structure of FTP, you can use the
File_get_contents Read
File_put_contents Write
, hello, I listened to your suggestion and found that running my PHP browser was loaded for a long time, showing a blank page.
Your code I also believe that absolutely no problem, but also show a blank page, how to solve the problem should not be the code.
My system Debian + NetBeans + NetBeans built-in PHP, the browser is Iceweasel
Is your FTP extension loaded?
My code is absolutely no problem, you can access ftp://ftp.mozilla.org with your browser
Slow speed is normal.
Is your FTP extension loaded?
My code is absolutely no problem, you can access ftp://ftp.mozilla.org with your browser
Slow speed is normal.
Hello, moderator, my FTP is on state, I'll take a look at it.
It doesn't seem like you can get the server data or anything like that, as you'll see in a blank page.
Is your FTP extension loaded?
My code is absolutely no problem, you can access ftp://ftp.mozilla.org with your browser
Slow speed is normal.
I tried to link to another station, but I got the following result, I can't get the server file time, I can't download the file
Mirror Update Connected to ftp.debian.org.
Logged in as Anonymous
Checking file Time ...
Local file Last updated14:02 24-may-2014
Can ' t access remote file time.
Getting file from server ...
Error:could not download file