perl - LWP::UserAgent and login credentials -



perl - LWP::UserAgent and login credentials -

i'm trying set credentials lwp::useragent, i'm not able log in. $username, $passwd correct. don't understand should set in 3rd argument(according dos $realm, here authentication). here snippet:

my $browser = lwp::useragent->new(agent => 'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.0.5) gecko/20060719 firefox/31.2.0', $browser->credentials("domain.com:80", "authentication",$username, $passwd); $response=$browser->get("http://domain.com/page"); print $response->content;

i corrected realm @thissuitisblacknot suggested:

close browser , reopen it. navigate http://domain.com/page. if site using basic authentication, should popup says username , password beingness requested http://domain.com. site says: "foo bar". in case, foo bar realm.

then able login, pages empty. have added cookie:

$browser->cookie_jar({ file => ".mycookies.txt" });

perl credentials lwp lwp-useragent

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -