miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

Auto Post To Forums

 
Author jt411
Partaker
#1 | Posted: 11 Dec 2013 00:58 
Creating a vibrant forum from start can be hard. I use this auto post script to help things get started.

<?php
/*
You can use this to post to your forum automatically
It might be a good idea to set the bb_specials.php accordingly for the forum you autopost to. Please read the manual regarding bb_specials.php settings

$lastOut=array(6);
$clForums=array();
$clForumsUsers[6]=array(3);
$roForums=array(6);
$poForums=array(6);
$regUsrForums=array();
$userRanks=array(3=>'Automate Bot');
$mods=array(
6=>array(3),
);

You can use a cron job to run this script but I would not over do it. In my case, I auto post about 3 times a day.

*/


//Start Editing

$websiteUrl="yourwebsitedotcom/";
$referrer="yourwebsitedotcom/";
$forumUrl="yourwebsitedotcom/forum/index.php";

//Forum Crendentials For User
$uName="forumuserName";
$uPass="forumuserPass";

$forumid="6";//id of forum to post to

//you can modify the code to include a MySQL statements to pull Title and Descriptor from a database to post to your forum
$pTitle="This is a test title";
$pDesc="This is a post description test";

//Stop Editing

$ch = curl_init();//initiate curl

//Let's Post
setForumCookie($websiteUrl, $referrer, $ch);//set's a session cookie
$data=setData($pTitle,$pDesc, $uName,$uPass,$forumid);
$data = http_build_query($data);

//log's in and post to forum
echo post2Forum($forumUrl."?", $referrer, $data, $ch);


function setData($pT,$pD,$uN,$pW,$fId)
{
$data = array(
'showSep' => '1',
'forum' => $fId,
'topicTitle' =>$pT,
'postText' => $pD,
'prevForm' => '0',
'user_usr' => $uN,
'user_pwd' => $pW,
'mode' => 'login',
'queryStr' => 'action=vtopic&forum='.$fId.'&showSep=1',
'action' => 'ptopic'
);
return $data;
}


function setForumCookie($wUrl, $refr, $ch)
{
curl_setopt ($ch, CURLOPT_URL,$wUrl);
curl_setopt ($ch, CURLOPT_POST, 0);
curl_setopt ($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt')); // cookie.txt
curl_setopt ($ch, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0');
curl_setopt ($ch, CURLOPT_REFERER, $refr);
curl_exec($ch);

}


function post2Forum($postUrl, $refr, $data, $ch)
{
curl_setopt ($ch, CURLOPT_URL,$postUrl);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt ($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt')); // cookie.txt
curl_setopt ($ch, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; U; Linux i586; de; rv:5.0) Gecko/20100101 Firefox/5.0');
curl_setopt ($ch, CURLOPT_REFERER, $refr);
curl_exec($ch);
return "Topic Posted";
}


?>

Author Paul
Lead Developer 
#2 | Posted: 11 Dec 2013 13:31 
Not sure what this script does?

Fill in the forum with the same kind of typical message i.e. 'This is a test title' or what kind of extra "database" there should be involved?

Also, I'm not sure why do you need CURL option to set cookies, send headers... why there's so much difficulties? If you want to "food up" the forum, just make direct mySQL inserts into forum database... wouldn't it be easier/quicker then?..

Specific miniBB Support Forums / Specific /
 Auto Post To Forums
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑