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;
}