FTP download w/ a proxy

drfloyd's Avatar, Join Date: Feb 2011
Newbie Member
Hi all,

I am relatively new to perl, about 1 month in, and have discovered that proxies are my nemesis.

I have a short script that uses LWP::UserAgent and downloads this file "ftp://ftp.cpan.org/pub/CPAN/README.html". I use statements $ua->proxy('ftp', "http//myproxy:80") and $request->proxy_authorization_basic("user", "password") and i can get the file which is cool.

Now my problem is:
1. I want to connect to a specific ip address instead of a host name
2. This ip address requires it's own username and password to enter unlike the cpan example which can be accessed using the anonymous username

Can I do this with the LWP::UserAgent? I've done some research on the Net::FTP module. I haven't seen a clear response or sample code where that module has proxy support something about FTP_PASSIVE? I'm a bit lost right now.


drfloyd's Avatar, Join Date: Feb 2011
Newbie Member
So I have done a bit more research. I found this simple FTP example:

use warnings;
use strict;
use Net::FTP;

my $ftp = Net::FTP->new("ftp.cpan.org") or die "Couldnt connect:$@\n";


However, I cannot get it to work as I am behind a proxy. Does anyone have any ideas as to how this can be modified so it works properly? I have tried the Firewall option to no avail.