Bonjour,

Je viens de mettre en place une connexion en http via HttpURLConnection.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
		InputStream flux =null;
		URL url = null;
		HttpURLConnection  c = null;
 
		try 
		{
			url = new URL("http://*******");
			c = (HttpURLConnection) url.openConnection();
			flux = c.getInputStream();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
 
		for(int i=0; i<36; i++)
		{
			try {
				messageId = messageId + (char)flux.read();
			} catch (IOException e) {
				e.printStackTrace();
			}	
		}
 
		try {
			flux.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
Je voudrais maintenant faire un appel avec requete = "https://***********";

J'ai essayer de remplacer les HttpURLConnection par HttpsURLConnection mais ça ne marche pas...

Si quelqu'un pouvait m'aider... Merci d'avance pour votre aide...