萨菲尔斯
One more time One more chance
|
弄好后放在百度BAE的Cron(定时任务)里面- <?php
- $bduss='必须填写';//你要回复贴子的id
- $content="必须填写";//你要回复的内容,如要换行请用\n,如要用图片请安照这个格式#(pic,2b8806e93901213f3c8b371655e736d12d2e95dc,442,614)
- header("content-Type: text/html; charset=Utf-8");
- function curl_post($pda,$url){
- $header = array ("Content-Type: application/x-www-form-urlencoded");
- $data=implode("&", $pda)."&sign=".md5(implode("", $pda)."tiebaclient!!!");
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- 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);
- return $re;
- }
- function getPage(){
- global $bduss,$tid;
- $pd=array(
- "BDUSS=".$bduss,
- "_client_id=03-00-DA-59-05-00-72-96-06-00-01-00-04-00-4C-43-01-00-34-F4-02-00-BC-25-09-00-4E-36",
- "_client_type=1",
- "_client_version=1.2.1.17",
- "_phone_imei=540b43b59d21b7a4824e1fd31b08e9a6",
- "back=0",
- "kz=".$tid,
- "net_type=3",
- "pn=1",
- "rn=2",
- "with_floor=1",
- );
- $gd=curl_post($pd,'http://c.tieba.baidu.com/c/f/pb/page');
- if($gd->error_code!=0)exit('发生错误:'.$gd->error_msg.'
- ');
- $tbs=$gd->anti->tbs;
- $fid=$gd->forum->id;
- $kw=$gd->forum->name;
- $title=$gd->thread->title;
- replyPost($kw,$tbs,$fid,$title);
- }
- function replyPost($kw,$tbs,$fid,$title){
- global $bduss,$tid,$content;
- $pd=array(
- "BDUSS=".$bduss,//替换你的cookies,最后不要";"的
- "_client_id=03-00-DA-59-05-00-72-96-06-00-01-00-04-00-4C-43-01-00-34-F4-02-00-BC-25-09-00-4E-36",
- "_client_type=1",
- "_client_version=1.2.1.17",
- "_phone_imei=540b43b59d21b7a4824e1fd31b08e9a6",
- 'anonymous=0',
- 'content='.$content,
- 'fid='.$fid,
- //'is_ad=0',
- "kw=".$kw,
- "net_type=3",
- 'tbs='.$tbs,
- 'tid='.$tid,
- 'title='
- );
- $gd=curl_post($pd,'http://c.tieba.baidu.com/c/c/post/add');
- if($gd->error_code!=0)exit($kw.'吧|'.$title.'|发生错误:'.$gd->error_msg.'
- ');
- echo $kw.'吧|'.$title.'|发表成功
- ';
- }
- getPage();
- ?>
复制代码 |
|