This is the solution that I have applied to the problem that httpclient deprecated in this version of android 22
public static String getContenxtWeb(String urlS) {
String pagina = "", devuelve = "";
URL url;
try {
url = new URL(urlS);
HttpURLConnection conexion = (HttpURLConnection) url
.openConnection();
conexion.setRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)");
if (conexion.getResponseCode() == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(conexion.getInputStream()));
String linea = reader.readLine();
while (linea != null) {
pagina += linea;
linea = reader.readLine();
}
reader.close();
devuelve = pagina;
} else {
conexion.disconnect();
return null;
}
conexion.disconnect();
return devuelve;
} catch (Exception ex) {
return devuelve;
}
}