Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example;
- // import the required classes
- import java.io.IOException;
- import okhttp3.OkHttpClient;
- import okhttp3.Request;
- import okhttp3.Response;
- public class Main {
- // create a new OkHttpClient instance
- final OkHttpClient client = new OkHttpClient();
- String run(String url) throws IOException {
- // create a request with the provided URL
- Request request = new Request.Builder()
- .url(url)
- .build();
- // execute the request and obtain the response
- try (Response response = client.newCall(request).execute()) {
- // return the response body as a string
- return response.body().string();
- }
- }
- public static void main(String[] args) throws IOException {
- // create an instance of the Main class
- Main example = new Main();
- // make a GET request to the specified URL and print the response
- String response = example.run("https://api.zenrows.com/v1/?apikey=<YOUR_ZENROWS_API_KEY>&url=https%3A%2F%2Fwww.amazon.com%2FLumineux-Teeth-Whitening-Strips-Treatments-Enamel-Safe%2Fdp%2FB082TPDTM2%2F%3Fth%3D1&js_render=true&premium_proxy=true");
- System.out.println(response);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement