try {
String auth = android.util.Base64.encodeToString((“USERNAME” + ":" + “PASSWORD”).getBytes("UTF-8"), android.util.Base64.NO_WRAP);
HttpParams httpParameters = new BasicHttpParams();
HttpPost request = new HttpPost(“URL” + ” ? action = xxx”);
request.addHeader("Authorization", "Basic " + auth);
httpParameters.setParameter("password", "xxxx");
httpParameters.setParameter("email", "xxxxxxx");
HttpConnectionParams.setSoTimeout(httpParameters, SOCKET_TIMEOUT_MS);
HttpClient client = new DefaultHttpClient(httpParameters);
HttpResponse response = client.execute(request);
String userAuth = EntityUtils.toString(response.getEntity());
Log.i("", "Data. in login.." + userAuth);
} catch (Exception e) {
Log.i("", "Error.." + e);
}
在这里,我设置了这个,但根据输出参数没有到达服务器端......