简陋的域名批量查询

突然发现,最近多了很多种域名后缀,像是.red .blue .pink 之类的。。貌似也不贵。。

自己做了个简陋的域名批量查询系统,,,呵呵,灰常简陋那种。。需要再次修改那种。。。


自己用火狐在sudu.cn随便抓了个包。。。

用post请求http://www.sudu.cn/domain/dmcheck_deal.php 以json格式发送待查询域名。。

返回也是json格式,,我就不折腾,稍微能就行。。。




package com.memorycat.domainquery;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URLDecoder;

public class DnChk {

	private boolean dochk(String name) throws Exception {
		String strUrl = "http://www.sudu.cn/domain/dmcheck_deal.php";
		URI url = new URI(strUrl);
		HttpURLConnection con = (HttpURLConnection) url.toURL()
				.openConnection();
		con.setDoInput(true);
		con.setDoOutput(true);
		con.setRequestMethod("POST");
		String str2Post = "valid_code=&dms="+name+".com%2C"+name+".red%2C"+name+".blue&i=1411525268935&enc=E&overseas=";
		con.connect();
		OutputStream outputStream = con.getOutputStream();
		outputStream.write(str2Post.getBytes());
		outputStream.close();
		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(con.getInputStream()));
		String tmp;
		while ((tmp = bufferedReader.readLine()) != null) {
			System.out.println(URLDecoder.decode(tmp));
		}
		bufferedReader.close();
		con.disconnect();
		return false;
	}

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		DnChk chk=new DnChk();
		chk.dochk("abc");
		chk.dochk("javadoc");
		chk.dochk("dreams");
		chk.dochk("memorycat");
	}

}



下面是执行结果,,,初步估计,返回0的是已经被注册了的。。。。其他数字就是未注册的,注册所需的金额


{"dm":{"abc.com":0,"abc.blue":0,"abc.red":0}}
{"dm":{"javadoc.com":0,"javadoc.blue":"<span class='gs'><i>\u84dd\u8272<\/i><\/span>&nbsp;&nbsp; <span><b>128<\/b> \u5143 \/ \u5e74<\/span>","javadoc.red":" <span><b>128<\/b> \u5143 \/ \u5e74<\/span>"}}
{"dm":{"dreams.com":0,"dreams.blue":"<span class='gs'><i>\u84dd\u8272<\/i><\/span>&nbsp;&nbsp; <span><b>128<\/b> \u5143 \/ \u5e74<\/span>","dreams.red":" <span><b>128<\/b> \u5143 \/ \u5e74<\/span>"}}
{"dm":{"memorycat.com":0,"memorycat.blue":"<span class='gs'><i>\u84dd\u8272<\/i><\/span>&nbsp;&nbsp; <span><b>128<\/b> \u5143 \/ \u5e74<\/span>","memorycat.red":" <span><b>128<\/b> \u5143 \/ \u5e74<\/span>"}}


评论
2015-09-02 11:48:45 1
摁.挺简陋的
文章信息
作者: admin
目录: java
创建: 2014-09-24
更新: 2014-09-24
如果文章对你有帮助,请博主喝杯咖啡:-)