perl - Per https Authentication fails -
i have few problems authenticating website via perl. can login website without problems using browser, if do, shows me little prompt, have supply credentials. easy going!
but wanted connect site using script , running 401 unauthorized error.
the server trying connect runs iis7 , www-authenticate header told me, realm 'negotiate, ntlm' (i tried 3 possibilities, 1 of words or both, nothing happened).
so far don't know how figure out information needed, last try form, have supply credentials , use submit_form function, forms, have establish connection.
i confused because tried of things found on google, don't know going on, technical view, give me hint.
well, appreciate it, if me , thank in advance doing it.
#!/usr/bin/perl use strict; use warnings; use lwp::useragent; use www::mechanize; use authen::ntlm; $url = "some.url"; $usr = 'bernd'; $pwd = 'bernd'; $mech = www::mechanize->new(ssl_opts => {verify_hostname => 0}); $mech -> credentials($url.":443","ntlm",$usr,$pwd); $mech->get("https://".$url); #added https, because $url doesn't have print $mech->forms; ps: bypassing of ssl verification due certificate problem had @ beginning.
i speculate in use of 4 parameter form of credentials method, netloc , user wrong.
when url https://www.example.com/foo/bar?quux;baz=42#fnord, netloc www.example.com:443.
the user string of ntlm domain, single backslash, , ntlm username, e.g. internal\bernd. mind if hardcode value string literal did in example, need escape backslash backslash.
check these possible errors.
Comments
Post a Comment