Help for this page

Select Code to Download


  1. or download this
    use LWP::UserAgent;
    $ua = new LWP::UserAgent;
    $req = new HTTP::Request GET => 'http://www.sn.no/secret/';
    $req->authorization_basic('aas', 'mypassword');
    print $ua->request($req)->as_string;
    # the above code returns the html code for the form
    
  2. or download this
    use LWP::UserAgent;
    $ua = new LWP::UserAgent;
    $ua->credentials('user', 'password');
    ...
    $req->authorization_basic('aas', 'mypassword');
    print $req->status_line, "\n";
    # the above returns 401 Access Denied