C#获取QQ在线状态代码
2007-06-05 13:16
615 查看
QQ号码 查询结果 查询语句
21117217 GIF89aJ http://wpa.qq.com/pa?p=1:21117217:3
195651222 GIF89aK http://wpa.qq.com/pa?p=1: 252520115:3
426002343 GIF89aJ http://wpa.qq.com/pa?p=1: 4366727:3
///添加相关引用
using System.IO;
using System.Net;
using System.Text;
//按钮事件
private void button3_Click(object sender, System.EventArgs e)
{
if(textBox3.Text=="")
{
MessageBox.Show("必须填写当前的查询的QQ号码!","错误提示!");
textBox3.Focus();
return;
}
else
{
string strQQ=textBox3.Text.Trim();
string strSearchQQ="http://wpa.qq.com/pa?p=1:"+strQQ+":3";
string strQQStatus=GetWebContent(strSearchQQ).Substring(0,7);
switch(strQQStatus)
{
case "GIF89aK":MessageBox.Show(strQQ+"不在线","QQ状态提示!");
break;
case "GIF89aJ":MessageBox.Show(strQQ+"不在线","QQ状态提示!");
break;
}
}
}
//调用函数
//根据Url地址得到网页的html源码
private string GetWebContent(string Url)
{
string strResult="";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
//声明一个HttpWebRequest请求
request.Timeout = 30000;
//设置连接超时时间
request.Headers.Set("Pragma", "no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamReceive = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("GB2312");
StreamReader streamReader = new StreamReader(streamReceive, encoding);
strResult = streamReader.ReadToEnd();
}
catch
{
MessageBox.Show("出错");
}
return strResult;
}
21117217 GIF89aJ http://wpa.qq.com/pa?p=1:21117217:3
195651222 GIF89aK http://wpa.qq.com/pa?p=1: 252520115:3
426002343 GIF89aJ http://wpa.qq.com/pa?p=1: 4366727:3
///添加相关引用
using System.IO;
using System.Net;
using System.Text;
//按钮事件
private void button3_Click(object sender, System.EventArgs e)
{
if(textBox3.Text=="")
{
MessageBox.Show("必须填写当前的查询的QQ号码!","错误提示!");
textBox3.Focus();
return;
}
else
{
string strQQ=textBox3.Text.Trim();
string strSearchQQ="http://wpa.qq.com/pa?p=1:"+strQQ+":3";
string strQQStatus=GetWebContent(strSearchQQ).Substring(0,7);
switch(strQQStatus)
{
case "GIF89aK":MessageBox.Show(strQQ+"不在线","QQ状态提示!");
break;
case "GIF89aJ":MessageBox.Show(strQQ+"不在线","QQ状态提示!");
break;
}
}
}
//调用函数
//根据Url地址得到网页的html源码
private string GetWebContent(string Url)
{
string strResult="";
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
//声明一个HttpWebRequest请求
request.Timeout = 30000;
//设置连接超时时间
request.Headers.Set("Pragma", "no-cache");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream streamReceive = response.GetResponseStream();
Encoding encoding = Encoding.GetEncoding("GB2312");
StreamReader streamReader = new StreamReader(streamReceive, encoding);
strResult = streamReader.ReadToEnd();
}
catch
{
MessageBox.Show("出错");
}
return strResult;
}
相关文章推荐
- C#获取QQ在线状态代码
- c#查询QQ状态是否在线查询代码
- c#查询QQ状态是否在线查询代码
- c#查询QQ状态是否在线查询代码
- 使用python检测手机QQ在线状态的脚本代码
- 网页中嵌套QQ代码设置在线状态无需加好友聊天
- QQ,MSN,SKYPE等在线状态代码
- 浅谈思路严谨的管理软件中的用户在线状态控制【附部分C#参考代码】
- QQ号码在线状态代码
- 查看QQ是否在线状态的网页代码
- QQ等即时通讯软件在线状态在Web页面显示代码
- QQ在线状态代码示例
- 网页中嵌套QQ代码设置在线状态无需加好友聊天
- 不加好友实现QQ在线代码状态临时会话
- 简易QQ在线状态代码生成器
- 浅谈思路严谨的管理软件中的用户在线状态控制【附部分C#参考代码】
- 不加好友实现QQ在线代码状态临时会话
- php获取qq用户昵称和在线状态(实例分析)
- QQ,MSN,SKYPE等在线状态代码 (转)
- 最全的IM在线联系在线状态在线交流代码(QQ,MSN,YAHOO,ICO,SKYPE,旺旺