简单的身份证偷取:
<%@ page import="java.io.*,java.net.*,java.util.regex.*"%>
<%@ page import="org.apache.commons.httpclient.HttpClient"%>
<%@ page import="org.apache.commons.httpclient.NameValuePair"%>
<%@ page import="org.apache.commons.httpclient.methods.PostMethod"%>
<%@ page import="com.meterware.httpunit.HttpException"%>
<%
request.setCharacterEncoding("utf-8");
String uid = request.getParameter("userid");
//URL url = new URL("http://wap.ip138.com/id.wml");
String temp = "服务器访问繁忙, 请待会进来<br/>";
HttpClient client = new HttpClient();
PostMethod authpost = new PostMethod(
"http://wap.ip138.com/id.asp");
NameValuePair userid = new NameValuePair("userid",
uid);
authpost.setRequestBody(new NameValuePair[] { userid});
try {
client.executeMethod(authpost);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String originalData = "";
originalData=authpost.getResponseBodyAsString();
authpost.releaseConnection();
if (originalData.indexOf("<p>") != -1)
temp = originalData.substring(originalData.indexOf("<p>") + 3, originalData.length());
else if (originalData.indexOf("<p align") != -1) {
temp = originalData.substring(originalData.indexOf("<p"), originalData.length());
temp = temp.substring(temp.indexOf(">")+1, temp.length());
}
temp = temp.substring(0, temp.indexOf("(c)"));
%>
<%
out.println(temp);
%>