HTML源码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
手机号码归属地查询官方版
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type=text/css>
body {font-size:14px;margin:0px;}
h1 {
font-size: 14px;
font-weight: bold;
margin: 0;
}
</style>
</head>
<body>
<table width="300px" height="220px" border="1" cellpadding="0" cellspacing="0" bordercolor="#a9cfe4" style="border-collapse: collapse" align="center">
<tr>
<td align="center" bgcolor="#a9cfe4" valign="middle" height="22px"><h1>手机号码归属地查询 - 手机定位追踪</h1></td>
</tr>
<tr>
<form onsubmit="return query();">
<td bgcolor="#FFFFFF" align="center" valign="middle" height="36px">请输入手机号码:<input id="m" size="15" maxlength="15" />
<input type="Submit" name="btnQuery" value="查询" id="btnQuery" /></td>
</form>
</tr>
<tr>
<td height="140px">
<div id="panelError" style="display:none;height:100%;text-align:center">
<span id="txtError" style="color:red">您输入的手机号码有误</span></div>
<div id="panelResult" style="display:none">
<table width="100%" height="140px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="112" align="center" bgcolor="#f2f6fb">手机号码:</td>
<td width="188" bgcolor="#f2f6fb"><span id="txtMobile">
</span></td>
</tr>
<tr>
<td align="center">所属省份:</td>
<td><span id="txtProvince"></span></td>
</tr>
<tr>
<td align="center" bgcolor="#f2f6fb">所属城市:</td>
<td bgcolor="#f2f6fb"><span id="txtCity"></span></td>
</tr>
<tr>
<td align="center">区 号:</td>
<td><span id="txtAreaCode"></span></td>
</tr>
<tr>
<td align="center" bgcolor="#f2f6fb">邮 编:</td>
<td bgcolor="#f2f6fb"><span id="txtPostCode"></span></td>
</tr>
<tr>
<td align="center">类 型:</td>
<td><span id="txtCard"></span></td>
</tr>
</table>
</div>
<div id="panelNotice" style="display:block; height:100%">
<br />
<br />
</div>
</td>
</tr>
</table>
<script type="text/javascript" src="http://api.showji.com/Locating/Query.js"></script>
</body>
</html>
JS源码:
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[13-9a-fh-ln-qt-vx-zC-Q]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 $(q){9 c.t(q)}7 d(){$(\'m\').select();$(\'m\').focus()}7 u(B,A){a w=v;1(w.x)w.x("on"+B,A);y 1(w.z)w.z(B,A,i)}7 C(){1($("m").j.replace(/(^\\s*)|(\\s*$)/g,"").D==0){$("E").6="请输入手机号码。";$("e").3.4=$("k").3.4="l";$("n").3.4="f";d();9 i}a o=c.getElementsByTagName(\'head\')[0];a p=c.t("F");1(p)o.removeChild(p);a b=c.createElement(\'script\');b.type="text/javascript";b.id="F";b.src="http://api.G.com/Locating/www.G.co.m.aspx?m="+escape($("m").j)+"&output=json&callback=H";o.appendChild(b);9 i}7 H(5){1(5["QueryResult"]!="True"){$("E").6="您输入的手机号码格式有误,请重新输入。";$("e").3.4=$("k").3.4="l";$("n").3.4="f"}y{1($("I")!=8)$("I").6=5["Mobile"];1($("J")!=8)$("J").6=5["Province"];1($("K")!=8)$("K").6=5["City"];1($("L")!=8)$("L").6=5["AreaCode"];1($("M")!=8)$("M").6=5["PostCode"];1($("N")!=8)$("N").6=5["Corp"]+5["Card"];1($("e").3.4!="f"){$("n").3.4=$("k").3.4="l";$("e").3.4="f"}}d()}7 O(P){a Q=new RegExp("(^|&|\\\\?)"+P+"=([^&]*)(&|$)"),r;1(r=v.location.search.match(Q))9 unescape(r[2]);9""}1(typeof(h)==\'undefined\')h=O("m");1(h.D>0){$("m").j=h;C()}u("load",d);',[],53,'|if||style|display|obj|innerHTML|function|null|return|var|oScript|document|selmobtext|panelResult|block||strMobile|false|value|panelNotice|none||panelError|oHead|oTar|objID|||getElementById|addEV|window||attachEvent|else|addEventListener|||query|length|txtError|remotejs|showji|querycallback|txtMobile|txtProvince|txtCity|txtAreaCode|txtPostCode|txtCard|QueryString|name|reg'.split('|'),0,{}))
我想通过java程序去获取返回的内容,请问怎样做呢?
另:我从JS中找到一个连接,但是这人连接打不开,用JAVA也连接不上。
在JAVA中,我是这样去读取网页内容的:
StringBuffer result = new StringBuffer();
URL url = null;
try {
url = new URL("http://www.baidu.com");
URLConnection UConn = url.openConnection();
BufferedReader breader = new BufferedReader(new InputStreamReader(UConn.getInputStream()));