Microsoft Visual J++. Java


CallCGI - 2


// URL

String StrEncoded = URLEncoder.encode(str);

 

//

System.out.println("Encoded string: >" +

StrEncoded + "<");

// URL CGI

u = new URL(

"http://frolov/frolov-cgi/controls.exe");

 

// CGI

c = u.openConnection();

 

//

// CGI

ps = new PrintStream(c.getOutputStream());

 

// CGI

ps.println(StrEncoded);

 

//

ps.close();

 

//

// CGI

is = new DataInputStream(c.getInputStream());

System.out.println(

"\n------------------------------------------" +

"\n Data from CGI extension" +

"\n------------------------------------------\n");

 

 

//

while (true)

{

//

str = is.readLine();

 

// ,

if(str == null)

break;

 

//

System.out.println(str);

}

 

//

is.close();

 

}

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

try

{

System.out.println(

"Press <Enter> to terminate application...");

 

System.in.read(bKbdInput);

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

}

}