@Override
public void run() {
// TODO Auto-generated method stub
String reqUrl
= "http://xxxxxxxxxx.com";
String postContent
= "addsubmit=true";
try {
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
conn.setRequestProperty("Cookie", cookie); // 注入cookie (String cookie)
conn.getOutputStream(), "UTF-8");
osw.write(postContent.toString());
osw.flush();
osw.close();
// e.printStackTrace();
Log.e("发送请求超时!");
}
try {
// 读取返回内容
try {
"UTF-8"));
while ((temp = br.readLine()) != null) {
buffer.append(temp);
buffer.append("\n");
}
e.printStackTrace();
Log.e("读取结果失败");
}
Log.d(buffer.toString());
int pos = buffer.toString().indexOf("id=\"message\""); //查找返回页面关键词
if (pos == -1) {
pos = buffer.toString().indexOf("class=\"list_tip");
}
if (pos == -1) {
Log.e("查找结果关键字失败!");
}
} else {
Log.e("页面错误!");
}
// TODO Auto-generated catch block
// e.printStackTrace();
Log.e("读取结果超时!");
}
}