If the problem is indeed cookies, then you should use a
module like HTTP::Cookies to store a 'cookie jar'
for you. You might need to log in as well. Here is a script
that i use to post comment to the Chatterbox from a
terminal. Meditate upon it and see if you can write a
similar script to solve your problem. You will probably not
want to use Netscape cookies as well - YMWV. If you do use
Netscape cookies, you will need to launch Netscape, log in
to the site, and exit Netscape to save the proper cookie.
Otherwise, read the HTML code for the login form and supply
the proper form values in the call to POST().
use strict;
use LWP;
use HTTP::Request::Common;
use HTTP::Cookies;
print "\n: ";
chomp ($_ = <>);
use constant URL => 'http://www.perlmonks.org/';
my $ua = LWP::UserAgent->new;
$ua->agent('chat_poster/1.0 (' . $ua->agent .')');
$ua->cookie_jar(HTTP::Cookies::Netscape->new(
file => $ENV{HOME} . '/.netscape/cookies',
autosave => 1
));
my $request = POST(URL,
Content => [
op => 'message',
message_send => 'talk',
message => $_,
]
);
# this is just to gain back control of the terminal
# you will probably want to not fork for your problem
exit if fork();
my $response = $ua->request($request);
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)
|