HttpGet request = new HttpGet("http://www.ineeke.com/android/android.php?name="+etName.getText().toString()+"&pwd="+etPwd.getText().toString());
try {
HttpResponse response = new DefaultHttpClient().execute(request);
if(response.getStatusLine().getStatusCode() == 200){
String result = EntityUtils.toString(response.getEntity());
Toast.makeText(Main.this, result, Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(Main.this, e.getMessage().toString(), Toast.LENGTH_LONG).show();
e.printStackTrace();
}
http 请求示例
最新推荐文章于 2021-04-14 15:01:09 发布