要发送UID和Pass到PHP文件::
List updatemsg = new ArrayList();
updatemsg.add(new BasicNameValuePair("uid", uidmsg));
updatemsg.add(new BasicNameValuePair("pass", passmsg));
ttpClient httpclient = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 10000); //Timeout Limit
HttpPost httppost = new HttpPost("your_url.php");
httppost.setEntity(new UrlEncodedFormEntity(updatemsg));
httpclient.execute(httppost);
而摆脱PHP文件::
HttpClient httpclient = new DefaultHttpClient();
HttpConnectionParams.setConnectionTimeout(httpclient.getParams(), 10000); //Timeout Limit
HttpPost httppost = new HttpPost("your_url.php");
httppost.setEntity(new UrlEncodedFormEntity(updatemsg));
HttpResponse response = httpclient.execute(httppost);
InputStream content = response.getEntity().getContent();
BufferedReader buffer = new BufferedReader(new InputStreamReader(content));
String s = "";
while ((s = buffer.readLine()) != null) {
//s is the returned value;
}