public static String getHttpResponce (String URL) {
try {
HttpConnection httpConnection = (HttpConnection) Connector.open(URL);
httpConnection.setRequestMethod(HttpConnection.GET);
InputStream inputStream = httpConnection.openInputStream();
StringBuffer sb = new StringBuffer();
int C;
while( -1 != (C = inputStream.read()))
{
sb.append((char)C);
}
return sb.toString();
} catch (Exception e) {
return "-1";
}
}
Comments