Skip to content

Instantly share code, notes, and snippets.

@aanoaa
Created November 30, 2012 06:04
Show Gist options
  • Save aanoaa/4174039 to your computer and use it in GitHub Desktop.
Save aanoaa/4174039 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use utf8;
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Request::Common;
my $ua = LWP::UserAgent->new(
agent => 'Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20100101 Firefox/10.0.11 Iceweasel/10.0.11',
);
push @{ $ua->requests_redirectable }, 'POST';
$ua->cookie_jar(HTTP::Cookies->new);
$ua->add_handler(
'request_prepare' => sub {
my ($req, $ua, $h) = @_;
print $req->as_string, "\n" if $ENV{DEBUG};
}
);
$ua->add_handler(
'response_done' => sub {
my ($res, $ua, $h) = @_;
print $res->as_string, "\n" if $ENV{DEBUG};
}
);
open my $fh, '<', 'account.txt' or die "failed to open account.txt: $!\n";
my $line = <$fh>;
chomp $line;
my ($email, $password) = split /,/, $line;
my $res = $ua->request(
POST "http://git.silex.kr/users/sign_in",
[
# utf8 => '✓',
'user[email]' => $email,
'user[password]' => $password,
'user[remember_me]' => '0',
]
);
$res = $ua->request(GET "http://git.silex.kr"); # not working
@aanoaa
Copy link
Author

aanoaa commented Nov 30, 2012

쿠키를 통한 세션유지를 할 수 없음 Cookie 헤더 말고 다른 뭔가를 더 사용하남?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment