这是客户端程序.服务器程序就不写了,服务器只需要接收下参数然后解析即可.
public void client() {
try {
//配置提交参数
RequestParams params = new RequestParams();
//用户名
params.put("username", "123123");
//身份证号
params.put("idcard", "123123");
//POST 提交
AsyncHttpClient client = new AsyncHttpClient();
//地址以及参数
client.post("http://192.168.1.1", params,
new AsyncHttpResponseHandler() {
public void onSuccess(String response) {
//成功返回结果
}
public void onFailure(Throwable e) {
//失败处理
}
});
} catch (Exception e){
new AlertDialog.Builder(ConfirmationActivity.this).setTitle("提示").setMessage("请求失败:" + e.getMessage()).setPositiveButton("确定", null).show();}
}