Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- //...
- // create Chrome Web Client instance using specified proxy settings.
- try (final WebClient webClient = new WebClient(BrowserVersion.CHROME, PROXY_HOST, PROXY_PORT)) {
- // navigate to target web page
- Page page = webClient.getPage("https://httpbin.io/ip");
- // extract the content as string
- String pageContent = page.getWebResponse().getContentAsString();
- // print the content
- System.out.println(pageContent);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement