Logging into Junco app with LWP #perl #programming sub test_log_into_account { my $email = shift; my $password = shift; my $function = "login"; my $domain = Config::get_value_for("email_host"); my $prog = Config::get_value_for("cgi_app"); my $url = "http://$domain" . "$prog/$function"; my $browser = LWP::UserAgent->new; my $response = $browser->post( $url, [ 'password' => $password, 'email' => $email ], ); # my $cookie_jar = HTTP::Cookies->new(file => 'lwpcookies.txt', autosave => 1, ignore_discard => 1); # $cookie_jar->extract_cookies($response); # $cookie_jar->save; # print $cookie_jar->as_string . "\n"; # print Dumper $response; # print Dumper $response->header('set-cookie'); my @cookies= $response->header('set-cookie'); foreach my $c (@cookies) { my @a = split(/;/, $c); my @b = split(/=/, $a[0]); print "name=$b[0]\n"; print "value=$b[1]\n\n"; } } From JR's : articles 103 words - 995 chars created on Oct 15, 2013 at 12:45:48 pm updated on Oct 15, 2013 at 03:28:45 pm - # source - versions