Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

online java http request demo

public void get(String uri) throws Exception {
    HttpClient client = HttpClient.newHttpClient();
    HttpRequest request = HttpRequest.newBuilder()
          .uri(URI.create(uri))
          .build();

    HttpResponse<String> response =
          client.send(request, BodyHandlers.ofString());

    System.out.println(response.body());
}
Source by openjdk.java.net #
 
PREVIOUS NEXT
Tagged: #online #java #http #request #demo
ADD COMMENT
Topic
Name
7+4 =