Bonjour,
je developpe une petite appli permettant de mettre a jour son ip chez dyndns.
l'url est de la forme:
http://monlogin:monpassword@members.dyndns.org/nic/update?system=dyndns&hostname=mondomaine&myip=monip&wildcard=OFF&backmx=NO&offline=NO"
pour mettre a jour je faire donc:
j'ai codé ceci:
mais ca me sort un erreur ioexception 401 page not found.
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 try { URL url = new URL(urlSite); URLConnection _urlConnection = url.openConnection(); InputStream in = _urlConnection.getInputStream(); int c = in.read(); StringBuilder build = new StringBuilder(); while (c != -1) { build.append((char) c); c = in.read(); } String str = build.toString(); System.out.println("sortie de l'update: "+ str); } catch(MalformedURLException ex) { System.out.println("Exception URL: " + ex.getMessage()); } catch(IOException ex) { System.out.println("Exception IO : " + ex.getMessage()); }
alors que si je test l'url contenu dans la variable urlSite dans firefox, ca marche nickel.
Ou est l'erreur svp?
merci
Partager