I have an issue on my Android Project,
I want to call php page with get method and I use HttpURLConnection, when I run this application give an error "app has stopped"
This is my code
public void someFunction() throws IOException {
String inputLine = "";
URL url = new URL("http://www.domain.com/demo.php?test=abc");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder result = new StringBuilder();
String line;
while((line = reader.readLine()) != null) {
result.append(line);
}
} finally{
in.close();
}
}
What should I do?
Thanks.