0
I’m trying to make an httpget connection from android to php, I made all php code connecting to mysql but starts giving error from after "urlConnection = ..."
protected String doInBackground(String... String username = (String) arg0[0];
String password = (String) arg0[1];
String urlString = "https://splitfz.000webhostapp.com/login.php?username=" + username + "&password=" + password;
StringBuffer chaine = new StringBuffer("");
URL url;
HttpURLConnection urlConnection = null;
try {
url = new URL("https://splitfz.000webhostapp.com/login.php?username="+ username +"&password="+ password +"");
urlConnection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("User-Agent", "");
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.connect();
InputStream in = urlConnection.getInputStream();
InputStreamReader isw = new InputStreamReader(in);
int data = isw.read();
while (data != -1) {
char current = (char) data;
data = isw.read();
System.out.print(current);
}
this.statusField.setText("deu certo");
} catch (Exception e) {
this.statusField.setText("deu erro");
e.printStackTrace();
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
}
Return chaine; }
Put the error that is displayed in the logcat
– Andrei Coelho
Welcome Friend! tour by the site and see How to create a Minimum, Complete and Verifiable example! So make it easier for the community to help you! Thank you!
– Thiago Luiz Domacoski