大家可以打开这个URL看看
http://wpa.qq.com/pa?p=1:你的QQ:3
如http://wpa.qq.com/pa?p=1:283984419:3
using System.Net; using System; public class QQUtility { public static bool IsOnline(string qq) { //283984419 string url = string.Format("http://wpa.qq.com/pa?p=1:{0}:3", qq); HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url); request.Headers.Set("Pragma", "no-cache"); HttpWebResponse HttpWResp = (HttpWebResponse) request.GetResponse(); //"/rtx_offline.gif""/rtx_online.gif" string query = HttpWResp.ResponseUri.PathAndQuery; switch (query) { case "/rtx_offline.gif": return false; //break; case "/rtx_online.gif": return true; //break; default: return true; } } } class test { static void Main() { Console.WriteLine(QQUtility.IsOnline("283984419")); Console.Read(); } }