下面是一段代碼,你的問題......
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用戶名和密碼 –