在https网址中发布数据时收到错误

时间:2017-10-21 04:45:54

标签: java android

我正在尝试将数据发布到url并返回json。这与http一起工作正常,但当我将我的网站http切换为https代码时,显示错误错误。

 protected String doInBackground(String... urls) {
        try {
            ServiceHandler sh = new ServiceHandler();
            String nextUrl = "https://megsta.com/h/gettokenapi.php";
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("email", emailstr));
            params.add(new BasicNameValuePair("pass", passstr));

            String jsonStr = sh.makeServiceCall(nextUrl, ServiceHandler.POST, params);
            Log.d("Response: ", "> " + jsonStr);
            if (jsonStr != null) {

                status = jsonStr;
            } else {
                Log.e("ServiceHandler", "Couldn't get any data from the url");
            }
        } catch (Exception e) {
            pDialog.dismiss();
            Log.d("Background Task", e.toString());
        }
        return status;
    }

0 个答案:

没有答案