http post 方法
public static boolean doPost() {
DefaultHttpClient httpclient = new DefaultHttpClient();HttpPost httpPost = new HttpPost("http://channel.api.duapp.com/rest/2.0/channel/channel");
MultipartEntity reqEntity = new MultipartEntity();
try {
reqEntity.addPart("uemail", new StringBody("zzm@163.com",Charset.forName("UTF-8")));
reqEntity.addPart("upwd", new StringBody("qq",Charset.forName("UTF-8")));
httpPost.setEntity(reqEntity);
HttpResponse httpResponse = httpclient.execute(httpPost);
String respJsonStr = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
Log.d("cnmobi","respJsonStr : = " + respJsonStr);
JSONObject obj = new JSONObject(respJsonStr);
return true;
}
catch (Exception e) {
Log.d("----","Exception : " + e);
return false;
}
}