import java
import
import
public class TestProxyIp {
public static void main(String args[]){
//System
System
System
System
}
private static String getHtml(String address){
StringBuffer html = new StringBuffer();
String result = null;
try{
URL url = new URL(address);
URLConnection conn = url
conn
BufferedInputStream in = new BufferedInputStream(conn
try {
String inputLine;
byte[] buf = new byte[
int bytesRead =
while (bytesRead >=
inputLine = new String(buf
html
bytesRead = in
inputLine = null;
}
buf = null;
} finally {
in
conn = null;
url = null;
}
result = new String(html
}catch(Exception e){
e
return null;
}
html = null;
return result;
}
}
說明:如果代理IP地址不正確
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26141.html