5获取页面1

public static void main(String[] args)
{

try
{
URL url = new URL("http://www.csdn.net");
// BASE64Encoder encoder = new BASE64Encoder();
// String auth = "Basic"
// + encoder.encode("username:password".getBytes());
System.getProperties().put("proxySet", "true");
System.getProperties().put("proxyHost", "10.130.40.13");
System.getProperties().put("proxyPort", "8026");
URLConnection connection = url.openConnection();
// connection.setRequestProperty("Proxy-Authorization", auth);
String charset="utf-8";

BufferedReader in = new BufferedReader(new InputStreamReader(
connection.getInputStream(),charset));
String inputLine;
while ((inputLine = in.readLine()) != null)
{
System.out.println(inputLine);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}

你可能感兴趣的:(5获取页面1)