Failed to get server file time data, compelling +1, still unable to download, please pointing.

Source: Internet
Author: User
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
)

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.