Easily build your account into a chat robot similar to a pea pod (I)

» Technical toss » Easily build your account into a chat robot similar to a pea pod (I)

Source code from Giuem: post bar chat robot php source code (similar to pea pod bar)

轻松将你的账号打造成类似豌豆荚的聊天机器人(一)-极客公园

Do you want your account to be able to automatically respond to @ your own people like Pea Pod and stop snubbing @ your own people

source code

  <html lang="zh-cn"><head><meta charset="utf-8"> <!-- Source code from www.giuem. com --> <? php /** *Author:Giuem *Blog: http://www.giuem.com/ *Version: Alpha 0.0.1 */ $bduss="Fill in your BDUSS"// Edit your BDUSS $id="@ Unspeakable Whispering"// Robot ID, e.g. @ xxxx /*=======================The following contents cannot be edited=================================*/ $tbs=$tbs=json_decode(url_get(" http://tieba.baidu.com/dc/common/tbs ","","BDUSS=".$bduss))->tbs; 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; } Function getData() {//re [1] Reply re [2]@     global $bduss;     $re = url_get(" http://wapp.baidu.com/ ","","BDUSS=".$bduss);     echo base64_decode('PGEgaHJlZj0iaHR0cDovL3d3dy5naXVlbS5jb20iPkdpdWVtJ3MgQmxvZzwvYT48YnI+'); Preg_match_all ("/reply to my (d+)). *? @ my (d+))/", $re, $re);     return $re; } function getAtData(){     global $bduss;     $header = array ("Content-Type: application/x-www-form-urlencoded");     $data=array("BDUSS=".$bduss,"_client_id=wappc_1396611108603_817","_client_type=2","_client_version=6.1.2","_phone_imei=642b43b58d21b7a5814e1fd41b08e2a6","from=tieba","net_type=3","pn=1");     $data=implode("&", $data). "&sign=".md5(implode("", $data). "tiebaclient!!!");     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, " http://c.tieba.baidu.com/c/u/feed/atme ");     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 reply($tid="",$pid="",$content="",$kw=""){     global $tbs , $bduss;     $fid=json_decode(file_get_contents(" http://tieba.baidu.com/sign/info?kw= $kw&ie=utf-8"))->data->forum_info->forum_info->forum_id;     $header = array ("Content-Type: application/x-www-form-urlencoded");     $data=array("BDUSS=".$bduss,"_client_id=wappc_1396611108603_817","_client_type=2","_client_version=6.1.2","_phone_imei=642b43b58d21b7a5814e1fd41b08e2a6","anonymous=0","content=".$content,"fid=".$fid,"from=tieba","kw=".$kw,"net_type=3","quote_id=".$pid,"tbs=".$tbs,"tid=".$tid);     $data=implode("&", $data). "&sign=".md5(implode("", $data). "tiebaclient!!!");     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, " http://c.tieba.baidu.com/c/c/post/add ");     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);     if($re->error_code == 0){ Return "Successfully replied.";     }else{         return $re->error_msg;     } } function talk($content) {     $re=file_get_contents(" http://rmbz.net/Api/AiTalk.aspx?key=rmbznet&word= ".$content);     $re=json_decode($re)->content;     return $re; } $array_num=getData(); $at_num=$array_num[2][0]; Echo "@ number:". $at_num. "<br>"; for($i=0;$ i<$at_num;$i++){     $re=getAtData()->at_list;     $re_content=$re[$i]->content;     if(str_replace(" ","",$re_content) !== $ id){$re_content=str_replace($id," ",$re_content);}     $content=talk($re_content);     $result=reply($re[$i]->thread_id,$re[$i]->post_id,$content,$re[$i]->fname); Echo "Post it:"$ re[$i]->fname. ", Label:"$ Re [$i] ->thread_id. ", reply content: {$content}, {$result}<br>";     sleep(5); } ?>

The editing code must be encoded in UTF-8


usage method

Please stamp the link → _ →
It's basically the same as this. You can look at this and follow it


Precautions

This code is currently in the testing stage, not very stable and not very intelligent. It can only make basic replies. Don't take it seriously.

Code download

Code download


--End--

Post reply

Your email address will not be disclosed. Required items have been used * tagging

16 Replies to "Easily build your account into a chat robot similar to a pea pod (I)"