开发进行时...

crazy coder

Avatar

Java根据URL获取内容

<%
URL url = new URL("http://www.yahoo.com/");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is,"gb2312"));
String line="";
while((line = br.readLine())!=null){
out.println(line);
}
br.close();
is.close();
conn.disconnect();
%>


评论已关闭