Возникла трудность в отображении ответа сервера.
Есть код который открывает страницу и выводит содержимое в консоль.
Код: Выделить всё
public class HttpURLConnectionExample {
public static void main(String[] args) throws Exception {
int c;
URL myUrl = new URL("http://rrrr.com/testreg.php");
HttpURLConnection myUrlCon =
(HttpURLConnection) myUrl.openConnection();
System.out.println("Ответное сообщение: " +
myUrlCon.getInputStream());
System.out.println("=== Содержимое ===");
InputStream input = myUrlCon.getInputStream();
while(((c = input.read()) != -1)) {
System.out.print((char) c);
}
}
}