1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

FTP download w/ a proxy

Discussion in 'Perl' started by drfloyd, Feb 9, 2011.

  1. drfloyd

    drfloyd New 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.

    Thanks,

    Eric
     
  2. drfloyd

    drfloyd New 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";

    $ftp->login("anonymous");
    $ftp->cwd("/pub/CPAN");
    $ftp->get("README.html");
    $ftp->close;

    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.

    Eric
     

Share This Page