Using Net::FTP to get a file on the server : FTP « Network « Perl






Using Net::FTP to get a file on the server

    

use Net::FTP;

$ftp = Net::FTP->new("ftp.cpan.org", Timeout => 30)
        or die "Could not connect.\n";

$username = "anonymous";
$password = "asdf";

$ftp->login($username, $password)
        or die "Could not log in.\n";

$ftp->cwd('/pub/CPAN');

$remotefile = "CPAN.html";
$localfile = "file.txt";

$ftp->get($remotefile, $localfile)
        or die "Can not get file.\n";

   
    
    
    
  








Related examples in the same category

1.Using a Net::FTP Object
2.Simple FTP client
3.The following commands allow you to pick up a file via FTP
4.Login to a FTP server