mraza Posted November 3, 2009 Share Posted November 3, 2009 Hi i am working on a script which which i can post to phpbb forum, now what is happenning when i run my script and see in phpbb login status that i am login and posting in specific section but it will just show me that and nothing happens. no post will be submitted please any help here is the function. function posting($title,$content,$tweb,$fnum,$tuser,$tpass,$bad_words) { foreach ($bad_words as $naughty) { $content = str_ireplace($naugty, "*****", $content); } $forumid = $fnum; $post_fields =array( 'username' => $tuser, 'password' => $tpass, 'autologin' => 0, 'redirect' => 'index.php', 'login' => 'Log In', ); $lurl = $tweb."ucp.php"; // echo $lurl; $curl_url = $tweb."posting.php?mode=post&f=".$forumid; // echo $curl_url; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$lurl); curl_setopt($ch, CURLOPT_POST, 4); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_COOKIEJAR,"cookie1.txt"); $result= curl_exec ($ch); curl_close ($ch); // echo $result; $ch3 = curl_init(); curl_setopt($ch3,CURLOPT_URL,$curl_url); curl_setopt($ch3,CURLOPT_RETURNTRANSFER, true); curl_setopt($ch3,CURLOPT_CONNECTTIMEOUT,"120"); curl_setopt ($ch3, CURLOPT_HEADER, false ); curl_setopt($ch3,CURLOPT_COOKIEFILE,"cookie1.txt"); $souvik12345 = curl_exec($ch3); $error=curl_error($ch3); curl_close($ch3); preg_match('%name="form_token" value="(.*)"\ /\>%',$souvik12345,$security123); preg_match('%name="lastclick" value="(.*)"\ /\>%',$souvik12345,$lastclick); preg_match('%name="creation_time" value="(.*)"\ /\>%',$souvik12345,$ctime1); $lclick = explode('" />',$lastclick[1]); $post_fields123 = array( 'subject' => $title, 'message' => nl2br(htmlspecialchars_decode($content)), 'f' => $forumid, 'icon' => 0, 'disable_bbcode' => 0, 'disable_smilies' => 0, 'disable_magic_url' => 0, 'attach_sig' => 1, 'notify' => 0, 'topic_type' => 0, 'topic_time_limit' => "", 'creation_time' => $ctime1[1], 'lastclick' => $lclick[0], 'form_token' => $security123[1], 'sid' => $sid, 'post' => 'Submit', ); $ch2 = curl_init(); curl_setopt($ch2,CURLOPT_URL,$curl_url); curl_setopt($ch2,CURLOPT_RETURNTRANSFER, true); curl_setopt($ch2,CURLOPT_CONNECTTIMEOUT,"120"); curl_setopt($ch2, CURLOPT_POSTFIELDS, $post_fields123); curl_setopt ( $ch2, CURLOPT_HEADER, false ); curl_setopt($ch2,CURLOPT_COOKIEFILE,"cookie1.txt"); $souvik1234 = curl_exec($ch2); $error=curl_error($ch2); curl_close($ch2); } Thanks for any support Link to comment https://forums.phpfreaks.com/topic/180037-not-posting-via-curl-to-phpbb/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.