Greetings,
I'm creating an app using Tk for a forum moderator tool. I have the GUI created, and the tool almost done; minus the big issue. I am unable to 'trick' the forum (VBulletin) into 'thinking' that I am logged in.
I will use the tool while logged in, and I will pass my login credentials while attempting to do an action. Same result; return output is that I am not logged in. Any thoughts on how to have an app register a cookie (or other thoughts)?
Here is what I'm trying:
my $browser = LWP::UserAgent->new;
my $loginUrl = 'http://forum.webpage.com/index.php';
#my login credentials
my $loginResponse = $browser->post ($loginUrl, [ 'action' => 'login',
'username' => 'my use
+rname',
'password' => 'my pas
+sword' ]
);
die "$loginUrl error: ", $loginResponse->status_line
unless $loginResponse->is_success;
die "Weird content type at $loginUrl -- ", $loginResponse->content_typ
+e
unless $loginResponse->content_type eq 'text/html';
print "First resp: ".$loginResponse->content."\n";
# ban user
my $banUrl = 'http://forum.webpage/mod/ban.php';
my $banResponse = $browser->post ($banUrl, 'banUser' => "username here
+"
);
die "$banUrl error: ", $banResponse->status_line
unless $banResponse->is_success;
die "Weird content type at $banUrl -- ", $banResponse->content_type
unless $banResponse->content_type eq 'text/html';
print "Second resp: ".$banResponse->content."\n";
$loginResponse->content gives me the HTML output as if I wasn't logged in yet
$banResponse->content gives me the output "You are not logged in"
So this makes me think it's just a cookie issue through Tk. Been quite some time since I've worked with Tk, so any and all help is appreciated.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.