import java.io.IOException;
02 import java.net.HttpURLConnection;
03 import java.net.URL;
04
05
06 public class Qq{
07
08 public static String qUrl = "QQ号码";
09 private static int state = 1243;
10
11 public static void main(String[] args) {
12
13 String urlQ = "http://wpa.qq.com/pa?p=2:"+qUrl+":41";
14
15 try {
16 URL url = new URL(urlQ);
17 HttpURLConnection httpUrl = (HttpURLConnection) url.openConnection();
18
19 if(state==httpUrl.getContentLength())
20 System.out.println("QQ用户:["+qUrl+"]状态为在线");
21 else
22 System.out.println("QQ用户:["+qUrl+"]状态为离线/隐身");
23
24 }catch (IOException e) {
25 System.out.println("连接此URL"+urlQ+"抛出异常信息");
26 }
27 }
28
29 }
验证指定QQ用戶是否在线[JAVA版]
最新推荐文章于 2024-08-19 16:01:20 发布