- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <?php
- /* 注意 填入引号中! */
- $bduss="你的bduss";//填写你的bduss的值,前面不用带"bduss="
- $kw="贴吧名";//贴吧
- $con="";//设置回复内容,留空则代表智能回复
- $floor="1";//设置抢几楼,0代表2楼,1代表3楼!
- $sleep="10";//设置延迟
- /* 设置 */
- function get_list(){
- global $bduss,$kw;
- $header = array ("Content-Type: application/x-www-form-urlencoded");
- $data=array("BDUSS=".$bduss,
- "_client_id=wappc_1396611108603_817",
- "_client_type=2",
- "_client_version=5.7.0",
- "_phone_imei=642b43b58d21b7a5814e1fd41b08e2a6",
- "from=tieba",
- "kw=".$kw,
- "pn=1",
- "q_type=2",
- "rn=50",
- "with_group=1");
- $data=implode("&", $data)."&sign=".md5(implode("", $data)."tiebaclient!!!");
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, "http://c.tieba.baidu.com/c/f/frs/page");
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
- curl_setopt($ch, CURLOPT_TIMEOUT, 30);
- $re = json_decode(curl_exec($ch));
- curl_close($ch);
- echo 'Author:<a href="http://www.giuem.com">Giuem</a><br>';
- return $re;
- }
- function talk($content) {
- $re=file_get_contents("http://rmbz.net/Api/AiTalk.aspx?key=rmbznet&word=".$content);
- $re=json_decode($re)->content;
- return $re;
- }
- function url_get($url,$POSTcontent="",$cookie=""){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL,$url);
- if ($POSTcontent!=""){curl_setopt($ch, CURLOPT_POSTFIELDS,$POSTcontent);}
- if ($cookie!=""){curl_setopt($ch, CURLOPT_COOKIE,$cookie);}
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HEADER, 0);
- curl_setopt($ch, CURLOPT_TIMEOUT, 20);
- $output = curl_exec($ch);
- curl_close($ch);
- return $output;
- }
- $re=get_list();
- $fid=$re->forum->id;
- $re=$re->thread_list;
- $a=count($re);
- for($i=0;$i<$a;$i++){
- $reply=$re[$i]->reply_num;
- $tid=$re[$i]->tid;
- if($reply==$floor){
- $title=$re[$i]->title;
- $tbs=json_decode(url_get("http://tieba.baidu.com/dc/common/tbs","","BDUSS=".$bduss))->tbs;//www.oicqzone.com
- if($con==""){$content=talk($title);} else {$content=$con;}
- echo "title:".$title." reply:".$content.",";
- $text=url_get("http://tieba.baidu.com/f/commit/post/add","ie=utf-8&kw=".$kw."&fid=".$fid."&tid=".$tid."&tbs=".$tbs."&content=".$content,"BDUSS=".$bduss);
- if (strpos($text,'no":0,"')!="0"){echo "succeed<br>";}
- else {echo "fail<br>";}
- sleep($sleep);
- }
- }
- echo 'ok';
- ?>
标签: php
顶一下
(2)
100%
踩一下
(0)
0%