Answers
一般添加referer和UA的信息就可以了。例如下面代码:
final HttpClient httpClient = new HttpClient();
final GetMethod getMethod = new GetMethod(url);
getMethod.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, charset);
getMethod.getParams().setSoTimeout(5000);
getMethod.addRequestHeader("Referer", "http://www.baidu.com");
getMethod.addRequestHeader("User-Agent",
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5");
se⑦en
answered 12 years, 7 months ago