HTTPS/Authenticated

Revision as of 05:51, 8 June 2007 by rosettacode>Daxim (Perl)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The goal of this task is to demonstrate HTTPS requests with authentication.

Task
HTTPS/Authenticated
You are encouraged to solve this task according to the task description, using any language you may know.

Perl

use LWP::UserAgent qw();
my $ua = LWP::UserAgent->new;
my $netloc = 'http://www.buddhism-dict.net/cgi-bin/xpr-dealt.pl:80';
$ua->credentials(
   $netloc,
   'CJK-E and Buddhist Dictionaries', # basic realm
   'guest',  # user
   '',       # empty pw
);
my $response = $ua->get($netloc);
use WWW::Mechanize qw();
my $mech = WWW::Mechanize->new;
$mech->get('https://login.yahoo.com/');
$mech->submit_form(with_fields => {
    login         => 'XXXXXX',
    passwd        => 'YYYYYY',
    '.persistent' => 'y',  # tick checkbox
});