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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
String retString = "";
InputStream in=null;
boolean nOK = true;
while( nOK ) {
nOK = false;
try {
urlConn = url1.openConnection();
urlConn.setDoOutput(true);
urlConn.setDoInput(true);
urlConn.getDefaultAllowUserInteraction();
printout = new DataOutputStream(urlConn.getOutputStream());
String content ="submit=validationOK&";
content +="ndi=0"+tel;
content +="&submit=Tester";
printout.writeBytes(content);
//content ="&test_adsl=on";
//printout.writeBytes(content);
printout.flush();
printout.close();
// Get response data.
input = new BufferedReader(
new InputStreamReader( urlConn.getInputStream() ) );
String str;
while (null != ((str = input.readLine()))) {
retString += str;
}
System.out.println(retString);
input.close();
} catch (IOException ex) {
ex.printStackTrace();
nOK = true;
}
if ( retString.length() < 150 ) {
nOK = true;
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
retString = "";
} |