String url ="http://www.imooc.com/api/teacher?type=4&num=50";
StringBuffer sb=new StringBuffer();
String line=null;
BufferedReader br =null;
try{
Url=new URL(url);
connection= (HttpURLConnection)Url.openConnection();
br=new BufferedReader(new InputStreamReader(connection.getInputStream()));
while((line=br.readLine())!=null){
sb.append(line);
}
}catch(Exception e) {
e.printStackTrace();
}
finally{
try{
br.close();
}catch(IOException e) {
e.printStackTrace();
}
}
returnsb.toString();