【发布时间】:2018-07-18 01:21:59
【问题描述】:
我正在尝试使用 php Web 服务将一些文本上传到我的服务器,而我的服务器具有 ssl 证书。当我尝试另一台没有 ssl 的服务器时,它可以正常工作。
谁能帮我解决这个问题?我在这个论坛上搜索了一整天。
请不要告诉我这是重复的问题(帮助初学者程序员)
这是我的代码:
protected String doInBackground(Void... params) {
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("base64", ba1));
nameValuePairs.add(new BasicNameValuePair("ImageName", System.currentTimeMillis() + ".jpg"));
nameValuePairs.add(new BasicNameValuePair("arrondi",arrondi));
nameValuePairs.add(new BasicNameValuePair("controleur",controleur));
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8"));
HttpResponse response = httpclient.execute(httppost);
String st = EntityUtils.toString(response.getEntity());
Log.v("log_tag", "In the try Loop" + st);
} catch (Exception e) {
Log.v("log_tag", "Error in http connection " + e.toString());
}
return "Success";
}
【问题讨论】:
-
欢迎来到 Stack Overflow!请编辑您的问题以显示您遇到的错误,否则没有人会知道从哪里开始帮助您。
标签: php android ssl androidhttpclient