Go4Expert (http://www.go4expert.com/)
-   Perl (http://www.go4expert.com/forums/perl/)
-   -   FTP download w/ a proxy (http://www.go4expert.com/forums/ftp-download-proxy-t24921/)

drfloyd 10Feb2011 00:32

FTP download w/ a proxy
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 10Feb2011 06:22

Re: FTP download w/ a proxy
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.


All times are GMT +5.5. The time now is 00:41.