Estou tentando fazer uma conexão httpget do android para o php, eu fiz todo codigo php conectando ao mysql mas começa dar erro a partir após do "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; }