jai_dgl has asked for the wisdom of the Perl Monks concerning the following question:

The Following script can be customized to get a NTLM server file to your local directory.
Can any one help me to put a local file in NTLM server ?
#!/usr/bin/perl use LWP::UserAgent; #use HTTP::Request::Common; use HTTP::Headers; use LWP::Debug qw(+); my $url = 'http://ntlmserver:portno/.aspx'; my $File_link = 'http://ntlmserver:portno/sample.txt'; my $ua = new LWP::UserAgent(keep_alive=>1); $ua->credentials('ntlmserver:portno', '', 'username', 'passwd'); $request = HTTP::Request->new( GET => $url, HTTP::Headers->new(user_agent => 'Internet Explorer/6.0', www_auth +enticate => 'NTLM') ); $filename = 'file.pdf'; $ua->mirror( $File_link, $filename )
Thanks
Jey

Replies are listed 'Best First'.
Re: Put Files in NTLM Server
by Khen1950fx (Canon) on Jul 13, 2010 at 08:26 UTC
    To POST a file to a ntlm server, I'd do something like this:
    #!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common qw(POST); my $url = 'http://www.ntlmserver:80/.aspx'; my $File_link = 'http://www.ntlmserver:80/file.pdf'; my $ua = new LWP::UserAgent(keep_alive=>1); $ua->credentials('www.ntlmserver:80', '', 'domain\\user', 'passwd'); my $req = POST $File_link; [ search => 'www', errors => 0 ]; print $ua->request($req)->as_string;