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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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, details, 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, summary, 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.