HttpURLConnection example

HttpURLConnection allows to open an HTTP connection and get a response.

URL url = new URL("");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
int statusCode = http.getResponseCode();
// if statusCode == 200, it means it's ok.
// other ways, it's an error you can deal with it.


You like this content ? Share it with you entourage !

Leave a Reply

Your email address will not be published.