#!/usr/bin/perl
#

use HTTP::Cookies;
use LWP::UserAgent;
use Data::Dumper;
use strict;
use warnings;

my $uname = "eirikn";
my $pass = "removed";

my $ua = new LWP::UserAgent;
$ua->timeout(15);
$ua->agent('Mozilla/5.0');

#$ua->credentials( "http://zepo.tg05.gathering.org", "/", $uname, $pass );

my $content;
my %form;
$form{'userid'} = $uname;
$form{'next'} = "Look me up";

#my $content = $ua->get("http://zepo.tg05.gathering.org/");


$content = $ua->post("http://zepo.tg05.gathering.org/login", \%form);

if (!defined($content->{'_headers'}{'location'})) {
	die "Could not find dudes";
}
$content->{'_headers'}{'set-cookie'} =~ /SID=(\w+);/;
my $sessioncookie = $1;
$content = $ua->get("https://partyticket.net/enter?dude_id=39457&got=it", "cookie" => "SID=".$sessioncookie.";");

$content->{'_headers'}{'set-cookie'} =~ /SID=(\w+);/;
$sessioncookie = $1;

print Dumper($content);

$form{'password'} = $pass;
$form{'userid'} = 39457;
$form{'next'} = "Log in";
$content = $ua->post("https://zepo.tg05.gathering.org/enter&got=it", "cookie" => "SID=".$sessioncookie, \%form);

print Dumper($content);




sub getpage {
	my ($page) = @_;

	
}
