// 接口类型:互亿无线实名认证接口
// 账户注册:https://user.ihuyi.com/register.html
// 注意事项:
// DEMO仅作参考
import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import util.StringUtil;
public class test {
private static String Url = "https://api.ihuyi.com/idcard/Submit.json";
public static void main(String [] args) {
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(Url);
client.getParams().setContentCharset("UTF-8");
method.setRequestHeader("ContentType","application/x-www-form-urlencoded;charset=UTF-8");
String account = "APPID";
String password = "APPKEY";
String app = "id2"; //固定值
String name = "张三";
String id_card_no = "123456789012345678";
String _now = "" + (System.currentTimeMillis() / 1000L);
String password_raw = account + password + app + name + id_card_no + _now;
// System.out.println((password_raw)
String password_md5 = util.StringUtil.MD5Encode(password_raw);
// System.out.println((password_raw)
NameValuePair[] data = {//提交请求
new NameValuePair("account", account),
// new NameValuePair("password", password),
new NameValuePair("password", password_md5),
new NameValuePair("app", app),
new NameValuePair("name", name),
new NameValuePair("id_card_no", id_card_no),
};
method.setRequestBody(data);
try {
client.executeMethod(method);
String res =method.getResponseBodyAsString();
System.out.println(res);
} catch (HttpException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
验证码已发送到您的手机,请查收!
输入验证码后,点击“开通体验账户”按钮可立即开通体验账户。