1.設置代理ip瀏覽器
1 HttpHost proxy = new HttpHost("112.36.34.134",80);//設置代理ip 2 3 RequestConfig config = RequestConfig.custom() 4 .setProxy(proxy) 5
2.延長訪問時間ui
1 RequestConfig config = RequestConfig.custom() 2 3 .setConnectTimeout(1000=0)// 建立鏈接的最長時間 4 .setConnectionRequestTimeout(1000)// 獲取鏈接的最長時間 5 .setSocketTimeout(1000)// 數據傳輸的最長時間 6 .build();
3.假裝成瀏覽器url
1 HttpGet httpGet = new HttpGet(url); 2 // 設置請求信息 3 //假裝瀏覽器 4 httpGet.setHeader("User-Agent","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0");