您的位置:首页 > 其它

检测QQ号码是否存在

2013-01-15 09:48 127 查看
腾讯QQ在线状态 WEB 服务

  Endpoint:http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx

  Disco:http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?disco

  WSDL:http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?wsdl

  



  通过输入QQ号码(String)检测QQ在线状态。返回数据(String)Y = 在线;N = 离线 ;E = QQ号码错误......

欢迎技术交流。 QQ:138986722

  

  

  Email 电子邮件地址验证 WEB 服务

  Endpoint:http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx

  Disco:http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx?disco

  WSDL:http://www.webxml.com.cn/WebServices/ValidateEmailWebService.asmx?wsdl

  



  Email 电子邮件地址验证 Web Service,通过查找给定的电子邮件域的邮件服务器和通过向邮件服务器发送数据来判断电子邮件地址正确与否。此Email地址验证Web Service请不要用于任何商业目的

java后台访问测试:

public static void main(String[] args) {
		while (true) {
			System.out.println("请输入要查询的QQ号码、输入“0”退出");
			java.util.Scanner in=new java.util.Scanner(System.in);
			String qq = in.next();
			if(qq.equals("0")){
				break;
			}
			String result = "";  
			String charset = "UTF-8";
			String callurl = "http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline?qqCode=";
			try {
				/*
				 * 通过输入QQ号码(String)检测QQ在线状态。 返回数据(String)Y = 在线;N = 离线 ;E =
				 * QQ号码错误
				 */
				java.net.URL url = new java.net.URL(callurl + qq);
				java.net.URLConnection connection = url.openConnection();
				connection.connect();
				java.io.BufferedReader reader = new java.io.BufferedReader(
						new java.io.InputStreamReader(connection
								.getInputStream(), charset));
				String line;
				/*
				 * 返回的格式 <?xml version="1.0" encoding="utf-8"?> <string
				 * xmlns="http://WebXml.com.cn/">E</string>
				 */
				while ((line = reader.readLine()) != null) {
					result += line;
					result += "\n";
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
			int len = result.indexOf("\">");
			if (len != -1) {
				String qStruts = result.substring(len + 2, len + 3);
				if (qStruts.equals("E")) {
					System.out.println("QQ号码错误");
				} else if (qStruts.equals("Y")) {
					System.out.println("在线");
				} else if (qStruts.equals("N")) {
					System.out.println("离线");
				}
			} else {
				System.out.println("服务器繁忙、请从试!");
			}
		}
	}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: