Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

NTLM authentication and save response content to a folder in the server

by cbartowski29 (Initiate)
on Nov 13, 2013 at 08:18 UTC ( #1062352=perlquestion: print w/ replies, xml ) Need Help??
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

Comment on NTLM authentication and save response content to a folder in the server
Download Code
Re: NTLM authentication and save response content to a folder in the server
by Random_Walk (Parson) on Nov 13, 2013 at 10:13 UTC

    Do you have some example code, so we can see how far you have got, and where your problem may lie. Or do you want us to write the entire thing from scratch for you? Please have a look at: How do I post a question effectively? and then update you original post.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!

      Hello, I already updated my post. Thanks!

Re: NTLM authentication and save response content to a folder in the server
by ww (Bishop) on Nov 13, 2013 at 11:52 UTC
    Looks like what you need is to open and write to a file. Suggest you read perldoc -f open (and don't forget close).
Re: NTLM authentication and save response content to a folder in the server
by Anonymous Monk on Nov 13, 2013 at 12:19 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1062352]
Approved by marto
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-12-27 03:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls