西西软件园多重安全检测下载网站、值得信赖的软件下载站!
软件
软件
文章
搜索

首页编程开发其它知识 → Q宠大乐斗协议获取好友信息代码

Q宠大乐斗协议获取好友信息代码

相关软件相关文章发表评论 来源:本站整理时间:2010/10/24 14:17:09字体大小:A-A+

作者:佚名点击:477次评论:0次标签: Q宠大乐斗 协议

  • 类型:网络认证大小:1.2M语言:中文 评分:6.6
  • 标签:
立即下载

乐斗获取好友信息十分简单,只需要携带cookie访问 http://fight.pet.qq.com/cgi-bin/petpk?cmd=view&kind=1&sub=1就可以了

   比较难的是分析个参数的意义,需要多个好友相互对比

       服务器返回如下:

   {result:'0',msg:'',info:[{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'0',name:'乐斗菜菜', lilian:'19',enable:'1', factionid:'0'},{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'0',name:'乐斗小王子', lilian:'37',enable:'2', factionid:'10007'},{uin:'xxxxxxxx',flag:'0',yflag:'0',qqflag:'2',name:'Going_Down', lilian:'32',enable:'1', factionid:'235884'},................

   其中uin为好友的QQ号码 ,flag没去研究 yflag为会员黄钻等信息  name为网名    lilian为等级  enable为0则已经和他打斗过  1 没有打斗过  2他有拳套,没有打斗过

   factionid为帮派ID

    给出代码:

   获取好友

public Dictionary<string,QchongEntity> getAllFriend()
{
Dictionary<string,QchongEntity> entitys =new Dictionary<string,QchongEntity>();

HttpHelper.Encoding = Encoding.GetEncoding("gb2312");
string result = HttpHelper.GetHtml("http://fight.pet.qq.com/cgi-bin/petpk?cmd=view&kind=1&sub=1", user.Cookie);
result = result.Replace("", "");
if (result !="")
{
//历练导致少取到5个号码
Regex r =new Regex("(uin:')(?<qq>[0-9]{5,11}?)(',flag:'[0-9]{1}',yflag:'[0-9]{1}',qqflag:')(?<qqflag>[0-9]{1}?)(',name:')"
+"(?<name>.+?)(',lilian:')(?<lilian>[0-9]{1,2}?)(',enable:')(?<enable>[0-9]{1}?)(',factionid:')(?<factionid>[0-9]{1,6}?)(')", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);

MatchCollection m = r.Matches(result);

for (int i =0; i < m.Count; i++)
{
try
{
QchongEntity entity =new QchongEntity();
entity.UserName = m[i].Groups["qq"].Value;
entity.Qqflag = Convert.ToInt32(m[i].Groups["qqflag"].Value);
entity.NickName = m[i].Groups["name"].Value;
entity.Liliang = m[i].Groups["lilian"].Value;
entity.Factionid = m[i].Groups["factionid"].Value;
entity.Enable = Convert.ToInt32(m[i].Groups["enable"].Value);
entitys.Add(entity.UserName,entity);
}
catch (Exception)
{
continue;
}
}
}

AllFriend = entitys;
return entitys;
}

    相关评论

    阅读本文后您有什么感想? 已有人给出评价!

    • 8 喜欢喜欢
    • 3 顶
    • 1 难过难过
    • 5 囧
    • 3 围观围观
    • 2 无聊无聊

    热门评论

    最新评论

    发表评论 查看所有评论(0)

    昵称:
    表情: 高兴 可 汗 我不要 害羞 好 下下下 送花 屎 亲亲
    字数: 0/500 (您的评论需要经过审核才能显示)