Ok found out how to do this, in PHP at least.
Basically, you do a POST operation, sending whatever info is required for login. That data has to be "URL Encoded", seperated by ampersands (&).
You then fetch the reply to that which includes one (or more) "Set-Cookie:" directives with the cookie data.
You parse that out (I use a Regex below) and store it, then initiate another Get or post operation including a "Cookie:" line in the header, along with the contents of the cookie data.
Now, this won't work if there is one of those "enter the magic number" graphical login things, but you could deal with that by displaying it to the user. Also, you may only need to do that once, instead caching whatever data these forums use to store the "autologin" (Usually a user-id and a hashed password) - from then on, you can just post that data along with the posted POI and you're done.
Note that this code is ugly ugly, in php, and worked for me logging into my own local instance of phpNuke. The code for this site would, of course, be different.
PHP Code:
<?
$post_data = "username=A_username&user_password=a_password&redirect=&mode=&f=&t=&op=login&submit=Login";
$sp = fsockopen("tcp://localhost", "80", $errno, $errstr, 15);
if ($sp)
{
fwrite($sp, "POST /ba_live/modules.php?name=Your_Account HTTP/1.0\r\n");
fwrite($sp, "Host: localhost\r\n");
fwrite($sp, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sp, "Content-length: " . strlen($post_data) . "\r\n");
fwrite($sp, "Accept: */*\r\n");
fwrite($sp, "\r\n");
fwrite($sp, "$post_data\r\n");
fwrite($sp, "\r\n");
$data = "";
while ( ($data = fread($sp, 8192)) != "" ) {
//echo "$data";
$raw_data .= $data;
}
fclose($sp);
} else {
echo "Unable to post data";
}
ereg("Set-Cookie: (u[^\r]+)", $raw_data, $match);
$my_cookie = $match[1];
$sp = fsockopen("tcp://localhost", "80", $errno, $errstr, 15);
if ($sp)
{
fwrite($sp, "GET /ba_live/index.php HTTP/1.0\n");
fwrite($sp, "Host: localhost\n");
fwrite($sp, "User-Agent: MSIE/6.0\n");
fwrite($sp, "Cookie: $my_cookie\n");
fwrite($sp, "\n");
$data = "";
while ( ($data = fread($sp, 8192)) != "" ) {
//echo "$data";
$raw_data .= $data;
}
fclose($sp);
} else {
echo "Error Opening Socket - $errno, $errstr";
die;
}
echo "Got Data:\n";
echo "<pre>";
echo htmlspecialchars($raw_data) . "</pre>";
?>