我有以下android POST代码。它适用于http,但对于具有不可信服务器证书异常的HTTPS失败。我不介意自我签名或接受所有证书代码(中间人攻击的安全性较差)。
HttpPost post = new HttpPost("https://yourdomain.com/yourskript.xyz");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("postValue1", "my Value"));
nameValuePairs.add(new BasicNameValuePair("postValue2", "2nd Value"));
nameValuePairs.add(new BasicNameValuePair("postValue3", "3rd Value"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpClient client = new DefaultHttpClient(); HttpResponse response =
client.execute(post); HttpEntity entity = response.getEntity();
String responseText = EntityUtils.toString(entity);
这里有任何帮助。我需要使用postValue1,postValue2和postValue3(最少3)提交POST的代码的证书部分。