Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > FTP PUT with proxy?

Thread Tools

FTP PUT with proxy?
Posts: n/a
I've been struggling with this forever now. Hopefully someone can help

Lets say you have the following:

proxy server:
proxy username: proxyuser
proxy password: proxypassword
ftp server:
ftp username: ftpuser
ftp password: ftppassword
file to PUT: myTextFile.txt

I've been trying to use LWP::UserAgent, HTTP::Headers, and
HTTP::Request without any real success.

Here's where I gave up (I'm not working on proxy auth yet):
use File::stat;
use LWP::UserAgent;

$stats = stat("myTextFile.txt");
$fileSize = $stats->size;
$ua = LWP::UserAgent->new;
$ua->proxy(['http', 'ftp'], '');
$header = HTTP::Headers->new;
$header->authorization_basic("ftpuser", "ftppassword");
open(FH, "myTextFile.txt");
read(FH, $buf, $fileSize);
$req = HTTP::Request->new("PUT", "",
$response = $ua->request($req);

Reply With Quote
DJ Stunks
Posts: n/a
      01-19-2006 Removed) wrote:
> Here's where I gave up

Funny, that's the same place I gave up.

Reply With Quote
Posts: n/a
(E-Mail Removed) wrote:
> I've been struggling with this forever now.

I feel your pain. I've got a proxy server at work that hates me and
conspires to cause problems with LWP (and ncftp and wcftp and lynx) no
matter how many configuration settings I futz around with.

However, cURL ( seems to punch through just fine
(I actually use cURL to pull down my CPAN updates using the

There's a nice CPAN interface module to libcurl:

(but this is a rare instance when I wouldn't object to using a system
command from Perl).


Reply With Quote
Posts: n/a
My solution was to use Net::FTP. No problems with that.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why does the following with Queue, q.put('\x02', True) not put itin the queue? Gabriel Rossetti Python 3 04-25-2008 03:41 PM
'Undifined commands' on FTP Server, when using FTP 'put' and 'quit' in Client Asaf Sinai Perl Misc 1 07-04-2006 01:02 PM
Put a file on an ftp server over ssl Daniel Santa Cruz Python 4 05-11-2005 01:14 PM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM
FTP put via ASP using Visual Basic TRB_NV ASP General 3 01-10-2004 08:14 AM