ปรับแต่งกันเอานะครับ ...
<?php
// post smf
posttosmf("ทำงานหรอ","อะไรล่ะครับบบบ","username","password","4","http://forum.xxx.com/");
function posttosmf($subj, $mess, $user, $password, $board, $domain) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_COOKIESESSION, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookie.txt');
curl_setopt($ch, CURLOPT_USERAGENT, "Automatic SMF poster thing");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=".$user."&passwrd=".$password);
curl_setopt($ch, CURLOPT_URL, "$domain?action=login2");
curl_exec($ch);
curl_setopt($ch, CURLOPT_URL, "$domain?action=post;board=".$board.".0");
$data = curl_exec($ch);
sleep(3);
preg_match ( "<input type=\"hidden\" name=\"sc\" value=\"(.*)\">", $data, $sc);
preg_match ( "<input type=\"hidden\" name=\"seqnum\" value=\"(.*)\">", $data, $seqnum);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "subject=".urlencode($subj)."&icon=xx&message=".urlencode($mess)."¬ify=0&lock=0&goback=1&sticky=0&move=0&attachment%5B%5D=&attachmentPreview=&post=xxxxx&sc=".$sc[1]."&seqnum=4&seqnum=".$seqnum[1]);
curl_setopt($ch, CURLOPT_URL, "$domain?action=post2;start=0;board=".$board);
curl_exec($ch);
curl_close($ch);
}
?>
ใส่ username password หมายเลข board ก้โพสได้แล้วครับ