1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
try {
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getParams()
.setParameter(HttpMethodParams.USER_AGENT,
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0)");
HttpRequestInterceptor preemptiveAuth = new BasicAuthRequestInterceptor();
httpclient.addRequestInterceptor(preemptiveAuth, 0);
httpGet = new HttpGet(
"URL que j'ai récupéré de DebugBar");
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(
"login", "password");
httpclient.getCredentialsProvider().setCredentials(AuthScope.ANY,
creds);
} catch (Exception e) {
e.printStackTrace();
} |
Partager