Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example;
- // import the required classes
- import java.net.URI;
- import java.net.http.HttpClient;
- import java.net.http.HttpRequest;
- import java.net.http.HttpResponse;
- import java.net.http.HttpResponse.BodyHandlers;
- public class Main {
- public static void main(String[] args) {
- // create an instance of HttpClient
- HttpClient client = HttpClient.newHttpClient();
- // build request using the Request Builder
- HttpRequest request = HttpRequest.newBuilder()
- .uri(URI.create("https://api.zenrows.com/v1/?apikey=<YOUR_ZENROWS_API_KEY>&url=https%3A%2F%2Fwww.g2.com%2Fproducts%2Fvisual-studio%2Freviews&js_render=true&premium_proxy=true"))
- .build();
- // send request asynchronously and print response to the console
- client.sendAsync(request, BodyHandlers.ofString())
- .thenApply(HttpResponse::body)
- .thenAccept(System.out::println)
- .join();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement