package bl.seven.http;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
public class SevenHttp {
public String goTo(String address) throws MalformedURLException,
UnsupportedEncodingException {
URL url = new URL(address);
StringBuffer sb = new StringBuffer();
try {
url = new URL(address);
BufferedReader in = new BufferedReader(new InputStreamReader(
url.openStream(), "UTF-8"));
String temp = null;
while ((temp = in.readLine()) != null) {
sb.append(temp);
}
in.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
return sb.toString();
}
}
JAVA程序访问页面并读取返回内容
最新推荐文章于 2022-04-07 17:50:08 发布