EmBodyHttpClientData clientData = new EmBodyHttpClientData();
HttpClient client = new HttpClient();
// 设置代理服务器地址和端口
// client.getHostConfiguration().setProxy("proxy_host_addr",proxy_port);
// 使用 GET 方法 ,如果服务器需要通过 HTTPS 连接,那只需要将下面 URL 中的 http 换成 https
HttpMethod method = new GetMethod("http://www.ss.com/s?wd=" + path
+ "&lm=" + whereV);
// 使用POST方法 http://www.ss.com/s?wd=site:www.project.com
// HttpMethod method = new PostMethod(" http://java.sun.com");
try {
client.executeMethod(method);
clientData.setStatus(method.getStatusLine().toString());
clientData.setData(method.getResponseBodyAsString());
System.out.println("-->"+method.getResponseBodyAsString());
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
method.releaseConnection();// 释放连接
try {
Thread.currentThread().sleep(3000);
} catch (InterruptedException e) {
}