package main;
import java.net.http.HttpClient;
public class MyCrawler {
public static void main(String [] args)
{
HttpClient httpClient = new DefaultHttpClient();
GetMethod getMethod=new GetMethod();
int statusCode=httpClient.executeMethod("https://www.baidu.com/");
System.out.println(statusCode);
System.out.println("response="+getMethod.getResponseBodyAsString());
getMethod.releaseConnection();
}
}
Error:(8, 37) java: 找不到符号
符号: 类 DefaultHttpClient
位置: 类 main.MyCrawler