Sometimes I love Perl. Thanks to Chris Ball, whose article on WWW::Mechanize I always seem to come back to for this sort of thing.


use strict;
use warnings;

use Data::Dumper;
use HTML::TokeParser;
use WWW::Mechanize;

my $openid_server_url = '';
my $openid_username = 'noodles';
my $openid_password = 'password';
my $openid_url = '';
my @ljusers = ('beccus', 'brrm', 'dpash', 'karen2205', 'lnr', 'padzor');

my $agent = WWW::Mechanize->new();
$agent->field("username", $openid_username);
$agent->field("password", $openid_password);

print "Logged into OpenID server.\n";

$agent->field("openid_url", $openid_url);

print "Logged into LiveJournal.\n";

foreach my $user (@ljusers) {
        print "Fetching feed for $user.\n";

        open(RSSFILE, ">$user.xml");
        print RSSFILE $agent->content;