@Override protected String doInBackground(String... params) { String tid = params[0]; HttpPostClient c = new HttpPostClient(url + tid); String cookie = PhoneConfiguration.getInstance().getCookie(); c.setCookie(cookie); String body = "__lib=topic_favor&__act=topic_favor&lite=js&noprefix&action=add&tid=" + tid; String ret = null; try { InputStream input = null; HttpURLConnection conn = c.post_body(body); if (conn != null) input = conn.getInputStream(); if (input != null) { String html = IOUtils.toString(input, "gbk"); ret = html; // getPostResult(html); } } catch (IOException e) { } return ret; }
@Override protected String doInBackground(String... params) { if (params.length < 2) return "parameter error"; String ret = "网络错误"; String url = params[0]; String body = params[1]; HttpPostClient c = new HttpPostClient(url); String cookie = PhoneConfiguration.getInstance().getCookie(); c.setCookie(cookie); try { InputStream input = null; HttpURLConnection conn = c.post_body(body); if (conn != null) { if (conn.getResponseCode() >= 500) { input = null; keepActivity = true; ret = "二哥在用服务器下毛片"; } else { if (conn.getResponseCode() >= 400) { input = conn.getErrorStream(); keepActivity = true; } else input = conn.getInputStream(); } } else keepActivity = true; if (input != null) { String html = IOUtils.toString(input, "gbk"); ret = getReplyResult(html); } else keepActivity = true; } catch (IOException e) { keepActivity = true; Log.e(LOG_TAG, Log.getStackTraceString(e)); } return ret; }