网上流传手机qq1.4协议,au3可以实现吗?
源码分析地址:http://www.12345t.com/code/php/20140309/254.htmlPHP代码如下:<?php
class SET_MQQ
{
function __construct($uin, $pwd)
{
$this->uin = $uin;
$this->pwd = $pwd;
$this->host= '119.147.14.253';
$this->port= '14000';
}
/*(1).登录QQ*/
function Login($code = 10)
{
$pack = 'VER=1.4&CON=1&CMD=Login&SEQ=' . rand(1,9000) . '&UIN='.$this->uin.'&PS=' . $this->pwd . '&M5=1&LG=0&ST='.$code.'&LC=812822641C978097&GD=5MWX2PF3FOVGTP6B&CKE=';
$return =$this->request_by_curl($pack);
if(strpos($return,"CMD=VERIFYCODE")){
$vc=explode("&VC=",$return);
$return=json_encode(array('status'=>'vc','res'=>$vc));
}elseif(strpos($return,"Password error")){
$return=json_encode(array('status'=>'password'));
}elseif(strpos($return,"&RS=0")){
$return=json_encode(array("status"=>"ok"));
}else{
$return=json_encode(array("status"=>"error",'qq'=>$this->uin,'result'=>$return));
}
return $return;
}
/*验证码处理*/
function Verifycode($code)
{
$pack = 'VER=1.4&CON=1&CMD=VERIFYCODE&SEQ=' . rand(1,9000) . '&UIN='.$this->uin.'&SID=&XP=C4CA4238A0B92382&SC=2&VC='.$code;
$return =$this->request_by_curl($pack);
if(strpos($return,"&VC=")){
$vc=explode("&VC=",$return);
$return=json_encode(array('status'=>'vc','res'=>$vc));
}else{$return=json_encode(array('status'=>'ok'));}
return $return;
}
/*更改在线状态*/
function ChangeStat($code)
{
$pack = 'VER=1.4&CMD=Change_Stat&SEQ=' . rand(1,9000) . '&UIN='.$this->uin.'&ST='.$code;
$return =$this->request_by_curl($pack);
if(strpos($return,"&RES=20")){
$return = $this->Login();
return $return;
//$return=json_encode(array('status'=>'offline'));
}else{$return=json_encode(array('status'=>'ok'));}
return $return;
}
/**/
function level($qq,$sid){
print_r($qq);
$url = "http://q32.3g.qq.com/g/s?sid=".$sid."&aid=nqqSelf";
$dos = file_get_contents($url);
$info1 = $this->preg_message($dos,"等级:<img", "subject",-1);
$level=floatval($info1);
$info2 = $this->preg_message($dos,"还有天", "subject",-1);
$day=floatval($info2);
$info3 = $this->preg_message($dos,"昵称:<br/>", "subject",-1);
$qname=$info3;
$data['level']=$level;
$day=((pow(($level+1),2)+4*$level)-$day+4);
$data['day']=$day;
$data['qname']=$qname;
return $data;
}
//截取字符
function preg_message($message, $rule, $getstr, $limit=1) {
$result = array('0'=>'');
$rule = $this->conver_trule($rule);//转义正则表达式特殊字符串
$rule = str_replace('\['.$getstr.'\]', '\s*(.+?)\s*', $rule); //解析为正则表达式
if($limit == 1) {
preg_match("/$rule/is", $message, $rarr);
if(!empty($rarr)) {
$result = $rarr;
}
} else {
preg_match_all("/$rule/is", $message, $rarr);
if(!empty($rarr)) {
$result = $rarr;
}
}
return $result;
}
/**
* 转义正则表达式字符串
*/
function conver_trule($rule) {
$rule = preg_quote($rule, "/");//转义正则表达式
$rule = str_replace('\*', '.*?', $rule);
$rule = str_replace('\|', '|', $rule);
return $rule;
}
/*转编码*/
function escape($str) {
preg_match_all("/[-].|[\x01-]+/",$str,$r);
$ar = $r;
foreach($ar as $k=>$v) {
if(ord($v) < 128)
$ar[$k] = rawurlencode($v);
else
$ar[$k] = "%u".bin2hex(iconv("GB2312","UCS-2",$v));
}
return join("",$ar);
}
/*(2).发送聊天消息*/
function SendMsg($toperson, $msg)
{
$msg2= str_replace("+"," ",$msg). '%0D%0A Powered by %e7%ac%91%e8%af%9d%e5%93%87';
$pack = 'VER=1.4&CON=0&CMD=CLTMSG&SEQ=' . rand(1,9000) . '&UIN='.$this->uin.'&SID=&XP=B58304217ADD0489&UN='.$toperson.'&MG='.$msg2;
$return =$this->request_by_curl($pack);
}
/*(3).获得即时聊天消息*/
function GetMsg($_reply)
{
$pack = 'VER=1.4&CON=0&CMD=GetMsgEx&SEQ='. rand(1,9000).'&UIN=' . $this -> uin . '&SID=&XP=29E41F6186ED43F8';
$return =$this->request_by_curl($pack);
$message=explode('&UN=',$return);
$unandmsg=$message;
$need=explode('&MG=',$unandmsg);
$need_MTstr=explode('&MT=',$message);
$need_mt=$need_MTstr;
$need_un=$need;
$need_mg=$need;
$un=explode(',',$need_un);
$mg=explode(',',$need_mg);
$mt=explode(',',$need_mt);
for($i=0; $i<count($un); $i++){
if($un[$i]!='' and $mt[$i]!='99'){
if($un[$i]!='10000'){
$n .= urlencode($this->GetInfo($un[$i],'NK','1',rand(1,9000)));//QQ昵称
$n .= '('.$un[$i];$n .= ')%0D%0A';//收到消息来自的QQ号码
$n .= urlencode($mg[$i]).'%0D%0A';//收到的消息的文本内容
//$this->SendMsg($un[$i],$_reply);
$udata[]=$un[$i];
}
}
else {
continue;
}
}
$data['msg']=$n;
$data['uin']=$udata;
return $data;
}
/*(4).查看好友信息*/
function GetInfo($toperson, $set, $lv)
{
$pack = 'VER=1.4&CMD=GetInfo&SEQ='.rand(1,9000).'&UIN=' . $this -> uin . '&LV='.$lv.'&UN='.$toperson;//配置信息详细程度LV
$return =$this->request_by_curl($pack);
$message=explode('&'.$set.'=',$return);
$need_arr=explode('&',$message);
$need=$need_arr;
//print_r($message);
//print_r($message["$set"]);
return $need;
}
/*(5).查看好友列表*/
function GetList()
{
$pack = 'VER=1.4&CMD=List&SEQ='.rand(1,9000).'&UIN='.$this->uin;//配置信息详细程度LV
$return =$this->request_by_curl($pack);
$need = explode('&UN=',$return);
return $need;
}
function request_by_curl($fields)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://{$this->host}:{$this->port}");
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_PROXY, PROXYIP);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "iQQol Client");
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
function HexToText($hex)
{
$str = "";
for($i = 0; $i < strlen($hex); $i += 2)
{
$str .=chr(hexdec($hex[$i].$hex[$i+1]));
}
return $str;
}
}
?>看起来有点像post,但是用Post又获取不到任何信息,不知道有没有人研究这方面的,是否可以提供一下思路。 顶一下,我也想学习 这个是wapQQ 回复 3# 绿色风
是java的吧,可以实现吗 如果不需要群功能的话。就直接WAPQQ,去POST很容易实现/. {:face (332):} 看我以前的帖子,不是很简单的事情。早实现了 回复 7# user11
你那个帖子没有源码呢 回复 5# 绿色风
不知道你说的WAPQQ是不是3GQQ,3GQQ post是很容易实现;如果你说的不是3GQQ,不需要群功能,如何实现呢?? 回复 9# chamlien
是WAPQQ就是3GQQ.需要开通手机超级QQ才支持群功能. 回复 10# 绿色风
怎么看源码都和3GQQ没多大关系呀,论坛里也有3GQQ的代码,你贴一下你的思路代码可以不 回复 11# chamlien
你用可以访问wap页的浏览器(如:opera...)去访问3gqq
再看网页的源码吧.
去分析一下对它的post/get
我之前做过3gqq的.如果需要,赞助点RMB给我.我可以给你我的源码(不带验证码处理).
你上面的那些所谓的协议也是post/get提交 回复 12# 绿色风
哎,说了这么多,你还是回到了3GQQ,3GQQ的验证码我都可以自己处理的,没什么用啊 回复 7# user11
可以提供一下思路或者源码吗? {:face (327):}
页:
[1]
2