下面是一段代码,你的问题......
private static class UserLogin extends AsyncTask<Void, Integer, String> {
protected String doInBackground(Void... userLogin) {
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("//domain//file.php?username=UN&password=&PW);
String result;
String userID = null;
try {
HttpResponse response = httpClient.execute(httpPost);
result = EntityUtils.toString(response.getEntity());
if (requestBuilder.jSONResultIsSuccess(result))
userID = requestBuilder.jSONUserID(result);
} catch (IOException | JSONException e) {
e.printStackTrace();
}
return userID;
}
你需要根据你自己的代码设计修改,但这显示了基本的结构。
什么是PHP文件的预期键值参数? – andrewdleach
[执行通过Android应用登录https网站](http://stackoverflow.com/questions/6443401/performing-login-to-https-website-via-android-app) – Pztar
@andrewdleach用户名和密码 –