crawler_httpclient代理访问

crawler_httpclient代理访问
 1 public String getDocumentByProxy(String url)
 2             throws ClientProtocolException, IOException {
 3         DefaultHttpClient httpclient = new DefaultHttpClient();
 4         HttpHost proxy = new HttpHost("127.0.0.1", 8087);
 5         httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,
 6                 proxy);
 7         HttpGet httpget = new HttpGet(IllegalCharacter(url));
 8         HttpResponse response = httpclient.execute(new HttpGet(url));
 9         String html;
10         try {
11             html = getContent(response, httpget.getURI().getHost());
12         } finally {
13             httpget.releaseConnection();
14             // 释放连接
15             httpclient.getConnectionManager().shutdown();
16         }
17 
18         return html;
19     }
crawler_httpclient代理访问

crawler_httpclient代理访问

上一篇:Toolbar Painter 工具条制作


下一篇:教你运用HDRI贴图制作3DSMAX金属材质(保温杯)