URL url = new URL("http://blog.csdn.net/mywait_00/article/details/1698627"); //設置代理 Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("openproxy.fsfd.com", 8080)); //打開代理 URLConnection coon = url.openConnection(proxy); //訪問的時候需要設置 user-agent coon.setRequestProperty("User-Agent","Mozila/4.0(compatible;MSIE 5.0;Windows XP;DigExt"); BufferedReader in = new BufferedReader(new InputStreamReader(coon.getInputStream())); String inputLine; StringBuffer html = new StringBuffer(); while ((inputLine = in.readLine()) != null) { html.append(inputLine); }
?
已有 0 人發(fā)表留言,猛擊->>這里<<-參與討論
ITeye推薦