62,614
社区成员
发帖
与我相关
我的任务
分享
Header locationHeader = postMethod.getResponseHeader("location");
System.out.println(locationHeader);
location = null;
if (locationHeader != null) {
location = locationHeader.getValue();
System.out.println("The page was redirected to:" + location);
} else {
System.err.println("Location field value is null.");
}
PostMethod p = new PostMethod("http://xxxx.com");
// 参数
NameValuePair email = new NameValuePair("email",
"xxxxxxxxxxx@126.com");
NameValuePair password = new NameValuePair("password", "xxxxxx");
NameValuePair[] params = new NameValuePair[] { email, password };
p.setRequestBody(params);
int status = c.executeMethod(p);
System.out.println(p.getResponseBodyAsString());