我是Android新手。我有一个要求,从Android手机发送数据到服务器。我已经使用了HttpClient。现在的问题是它是否是安全连接?我们如何确保这是安全的方式?请指导我这个主题:
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("user", user.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("pass", pass.getText().toString()));
Log.w("log_tag", "User" + user + "Pass" + pass);
//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://192.168.1.173/android/androidTest.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
Log.w("log_tag", "====" + user + "====" + pass);
HttpEntity entity = response.getEntity();
// is = entity.getContent();
Intent intent = new Intent();
intent.setClass(this,Result.class);
intent.putExtra("user", user.getText().toString());
intent.putExtra("pass", pass.getText().toString());
startActivity(intent);
}catch(Exception e){
Log.e("log_tag", "Error in http connection "+e.toString());
}
答案 0 :(得分:1)
“安全”是什么意思? SSL可能是?要么?如果您想要安全连接,请使用SSL。