What am I doing wrong?
Except for posting a password on a public website? ;) You aren't using strict and warnings. You are using C style for loop (not really wrong, but not very perlish). You're adding "\n\n" to the result returned by the credentials method, which is useless. And the first argument of the credentials is wrong. Here's a working example:
use 5.010; use strict; use warnings; use LWP::UserAgent; my @sites = ( "searchjid.usa.np.community.playstation.net", "searchjid.eu.np.community.playstation.net", "searchjid.jpn.np.community.playstation.net", ); my $path = "/basic_view/func/search_jid"; my $user = "c7y-basic01"; my $pass = "A9QTbosh0W0D^{7467l-n_>2Y%JG^v>o"; for (@sites) { my $browser = LWP::UserAgent->new; $browser->agent("PS3Community-agent/1.0.0 libhttp/1.0.0"); $browser->credentials( "$_:80", "c7y-basic", $user => $pass ); say $browser->head( "http://" . $_ . $path )->as_string; }
In reply to Re: How can I use LWP to log into digest-auth site and do post() (converting from PHP CURL)
by zwon
in thread How can I use LWP to log into digest-auth site and do post() (converting from PHP CURL)
by fgsfds100
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |