cbartowski29 has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, I'm really new to Perl Script and I'm developing a script to access a URL wiht NTLM authentication and save the response content in a folder. This content is a .xls, .doc, .pdf, .ppt, etc file. Actually,I was able to develop the NTLM authentication code. But my other requirement is to save the response content to a folder in the server. Can you help me with this?. Here's the sample code:
#!/usr/bin/perl use LWP::UserAgent; use HTTP::Request::Common; my $url = "http://myurl.com/AdsSDAF34141J"; my $ua = new LWP::UserAgent(keep_alive => 1); my $username = 'ap\<username>'; my $password = '<password>'; $ua->credentials('myurl.com:80', '', $username, $password); my $req = GET $url; print "--Peforming request now...---------\n"; my $res = $ua->request($req); print "--Done with request ...---------\n"; if ($res->is_success) { print $res->content; } else { print "Error: " . $res->status_line . "\n"; } exit 0;
I want to save the $res->content to a folder in the server. The value of $res->content is a file(excel, word, powerpoint, etc) Thanks in advance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: NTLM authentication and save response content to a folder in the server
by Random_Walk (Prior) on Nov 13, 2013 at 10:13 UTC | |
by cbartowski29 (Initiate) on Nov 13, 2013 at 11:21 UTC | |
|
Re: NTLM authentication and save response content to a folder in the server
by ww (Archbishop) on Nov 13, 2013 at 11:52 UTC | |
|
Re: NTLM authentication and save response content to a folder in the server
by Anonymous Monk on Nov 13, 2013 at 12:19 UTC |