T
Tuba Chuck
Im trying to make a script that will login to my Pitas blog and then
post an entry. I seem to be having problems with the cookies. The
script is:
#!/usr/bin/perl
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Cookies;
#Get needed info
print 'Login: ';
$uname = <STDIN>;
print 'Password: ';
$pass = <STDIN>;
print 'Date: ';
$date = <STDIN>;
print 'Time: ';
$time = <STDIN>;
print 'Title: ';
$pagename = <STDIN>;
print 'Entry: ';
$entry = <STDIN>;
$cookie_jar = HTTP::Cookies->new();
$login = LWP::UserAgent->new();
my $reql = POST 'http://www.pitas.com/cgi-bin/login.phtml', [
'username' => $uname, 'password' => $pass, 'remember_me' => 'no' ];
$responsel = $login->request($reql);
$addent = LWP::UserAgent->new();
my $requ = POST 'http://www.pitas.com/cgi-bin/update.phtml', [ 'date'
=> $date, 'time' => $time, 'url' => '#', 'pagename' => $pagename,
'entry' => $entry ];
$cookie_jar->add_cookie_header($requ);
$cookie_jar->extract_cookies($responsel);
$addent->request($requ);
exit;
post an entry. I seem to be having problems with the cookies. The
script is:
#!/usr/bin/perl
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use HTTP::Cookies;
#Get needed info
print 'Login: ';
$uname = <STDIN>;
print 'Password: ';
$pass = <STDIN>;
print 'Date: ';
$date = <STDIN>;
print 'Time: ';
$time = <STDIN>;
print 'Title: ';
$pagename = <STDIN>;
print 'Entry: ';
$entry = <STDIN>;
$cookie_jar = HTTP::Cookies->new();
$login = LWP::UserAgent->new();
my $reql = POST 'http://www.pitas.com/cgi-bin/login.phtml', [
'username' => $uname, 'password' => $pass, 'remember_me' => 'no' ];
$responsel = $login->request($reql);
$addent = LWP::UserAgent->new();
my $requ = POST 'http://www.pitas.com/cgi-bin/update.phtml', [ 'date'
=> $date, 'time' => $time, 'url' => '#', 'pagename' => $pagename,
'entry' => $entry ];
$cookie_jar->add_cookie_header($requ);
$cookie_jar->extract_cookies($responsel);
$addent->request($requ);
exit;