I'm trying to make an android httpget connection to php, I've done all php code connecting to mysql but start giving error starting after the "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; }