Hi Monks,
A little help please. I need to write some test scripts over our company sharepoint intranet (from and to windows), so to that end I need to authenicate through NTLM. No problem, I've updated libperl-www to 5.862, and set up the following...
use LWP::UserAgent;
my $ua = new LWP::UserAgent('keep_alive' => '1');
my $url = 'http://intranet/mypage';
$ua->credentials('intranet:80', '', "domain\\user", 'pass');
my $response =$ua->get($url);
print $response->code();
The above works just fine and returns a response code of 200, groovey. However, as I'll be following links, submitting forms etc, I'd obviously much rather use Mechanize. As I beleive Mechanize is built over LWP, I don't think this should be a problem, so try the following...
use WWW::Mechanize;
my $mech = WWW::Mechanize->new('keep_alive' => 1);
$mech->credentials('intranet:80', '', "domain\\user", 'pass');
$mech->get( 'http://intranet/mypage' );
print $mech->status();
Unfortunately, I can't get anything other than a 401 unauthorized out of this. I'm not sure how to attack this, so any advice much appreciated.
Thanks,
Rob
---
my name's not Keith, and I'm not reasonable.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|