I am trying to check the status of a SHOUTcast stream using this URL:
http://85.17.167.136:8684/7.html
... which returns data like:
<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>7,1,77,100,7,128,+44(0)7908 340 811 Follow Us @visionradiouk</body></html>
I know that the after the first comma returns 1 if the stream is up and running or returns 0 if the stream is down. My problem is getting the html of that page? I use this code, which works on other websites like Google etc.
TextView tView = (TextView) findViewById(R.id.textView1);
String htmlCode = "";
try {
URL url = new URL("http://85.17.167.136:8684/7.html");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine())!= null)
htmlCode += inputLine;
System.out.println(htmlCode);
tView.setText(htmlCode);
in.close();
} catch (Exception e){
System.out.println("error");
}
}
Any ideas on what I am doing wrong?
Heres Pulsarman325's working solution, tidied up, with a little extra stuff i had to add to get it to work (try/catch and variable initialisations)