#!/usr/bin/perl $| = 1; use strict; use warnings; use CGI::Carp qw(fatalsToBrowser); use LWP::UserAgent; use Net::FTP; use CGI; my $cgih = new CGI; print $cgih->header; my $url = "localhost"; my $ftp = Net::FTP->new($url, Debug => 0) or die "Cannot connect to $url: $@"; $ftp->login ('', ''); if(not defined $ftp){ my $errormsg=$@; onError(); } my @dir = $ftp->ls('*.*'); foreach (@dir) {print "$_
";} $ftp->quit; __END__ (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> Connected, sending welcome message... (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> 220-FileZilla Server version 0.9.29 beta (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse (Tim.Kosse@gmx.de) (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> 220 Please visit http://sourceforge.net/projects/filezilla/ (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> USER anonymous (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> 331 Password required for anonymous (000020) 07.01.2009 19:28:01 - (not logged in) (127.0.0.1)> PASS (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> 230 Logged on (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> PASV (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,9,30) (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> NLST *.* (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> 150 Connection accepted (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> 226 Transfer OK (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> QUIT (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> 221 Goodbye (000020) 07.01.2009 19:28:01 - anonymous (127.0.0.1)> disconnected. === [Perl]~ ftpt.pl Content-Type: text/html; charset=ISO-8859-1 FileZilla_Server-0_9_29.exe.md5
[Perl]~