StringBuffer response = new StringBuffer();
HttpURLConnection connection = null;
try
{
URL url = new URL("http://……");
connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String lines;
while((lines = reader.readLine()) != null)
{
if(lines != null && lines.trim().length() > 0)
{
response.append(lines.trim());
}
else
{
continue;
}
}
System.out.println(response.toString());
reader.close();
}
catch(Exception e)
{
throw e;
}
finally
{
if(connection != null)
{
connection.disconnect();
}
}