I'm developing a program to download some files from a vendor site. The site uses FTP with SSL. I can connect but my data connections are dropped. I think that the module is not allowing encryption on the data channel. I tested with lftp and my data connections (e.g. and ls command) only worked after I enable encryption on the data channel. Yes, the ls returns files and directories.
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTPSSL;
my $server = "ftps.example.com";
my $username = "*********";
my $passwd = "**********";
my @ret;
my $ftps = Net::FTPSSL->new( $server,
Debug => 1)
or error("Cannot reach $server");
$ftps->login($username, $passwd)
or error("Credential error, $ftps->last_message");
@ret = $ftps->list()
or error("Command error, $ftps->last_message");
$ftps->pwd();
print @ret;
Sample output:
>>> USER ********
<<< 331 Password required for ********.
>>> PASS ********
<<< 230 User ******* logged in.
>>> PBSZ 0
<<< 200 PBSZ Command successful.
>>> PROT P
<<< 200 PROT Command successful.
>>> PASV
<<< 227 Entering Passive Mode (**************)
>>> LIST
<<< 150 Opening data connection for '/bin/ls'.
<<< 226 Transfer complete.
>>> PWD
<<< 257 "/home/*******" is current directory.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|