Hello, I am brand new to perl. I am trying to create a perl script that will loggin to phpbb and post a message on a forum. Based on what I have found on the internet, this is what I have come up with.
This is the login url:
http://news.phxlab.honeywell.com/phpbb/login.php
And I believe this is important information:
<form action="login.php" method="post" target="_top">
This is the ultimate URL I want to get to:
http://news.phxlab.honeywell.com/phpbb/posting.php?mode=newtopic&f=12
And again, important information:
<form action="posting.php" method="post" name="post" onsubmit="return checkForm(this)">
Finally, here is the non-wroking code I have so far:
use strict;
use HTTP::Cookies;
use LWP::UserAgent;
use HTTP::Request::Common;
my $ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(file => "cookie2.txt",autosave => 1
+,));
my $url_base = "http://news.phxlab.honeywell.com/phpbb/posting.php?mod
+e=newtopic&f=12";
my $response = $ua->get($url_base);
#print $response->content;
my $request = HTTP::Request->new(POST=>'http://news.phxlab.honeywell.c
+om/phpbb/login.php?sid=725b728e071beec160e85c81d048a151');
$request->authorization_basic('username', 'password');
my $response = $ua->request($request);
my $content = $response->content;
$content =~ s/\n//g;#extracting session id
{
print $response->content; # or whatever
#print $content;
}
Any help you can offer will be much appreciated. Also, if you could sort of explain what's going on, that would help to. Thanks.
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.