I am trying to get JSON data by parsing login url with username and password. I have tried by using below code but I can\'t get any responses. Please help me.
I am u
Don't know about android but in POJ I use
public final class MyJSONObject extends JSONObject {
public MyJSONObject(URL url) throws IOException {
super(getServerData(url));
}
static String getServerData(URL url) throws IOException {
HttpURLConnection con = (HttpURLConnection) url.openConnection();
BufferedReader ir = new BufferedReader(new InputStreamReader(con.getInputStream()));
String text = ir.lines().collect(Collectors.joining("\n"));
return (text);
}
}