• Download a file from the FTP server, and save it into a local file:





    <?php
    // connect and login to FTP server
    $ftp_server = "ftp.example.com";
    $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
    $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass);
    // turn passive mode on
    ftp_pasv($ftp_conn, true);
    $local_file = "local.zip";
    $server_file = "server.zip";

    // download server file
    if (ftp_get($ftp_conn, $local_file, $server_file, FTP_ASCII))
      {
      echo "Successfully written to $local_file.";
      }
    else
      {
      echo "Error downloading $server_file.";
      }

    // close connection
    ftp_close($ftp_conn);
    ?>
  • 1 comment:

    1. Thankx a lot Megha for your Feedback.I am very pleased to hear that you are getting something valuable in my blog.

      ReplyDelete

    FAVOURITE LINE

    To steal ideas from one is plagiarism. To steal from many is Research.

    ADDRESS

    Mumbai , Maharashtra

    EMAIL

    shikha.pathak6@gmail.com
    shikha.the.swt.pari@gmail.com

    Skype

    shikha_pari