How to make HTTPS Post request from android to dif

2019-07-13 14:24发布

Here is how I try to make HTTPS Post request in android

String server ="https://myserver.com:4343/api";
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost(server);

List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("property", value));
request.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));

client.execute(request);

Now I have an error "No peer certificate", though certificate is correct and I can access server from browser with GET request.

I've tried different ways of doing POST request, tried to not specify schema or port in server string. No luck. What am I doing wrong?

0条回答
登录 后发表回答