I am using HTTPClient to connect to a website. The following code snippet is used for this purpose:
byte[] responseBody = method.getResponseBody();
System.out.println(new String(responseBody));
The above code displays the html code of the website. Next, I wanted to access only some data from the code, which I could access using JSoup using the following code fragment:
Document doc = Jsoup.connect(url).get();
In the above code, I explicitly specified the website URL using "url". that I do not require HTTPClient if I use JSoup. Is there a way that I can use the "responseBody" obtained with the HTTPClient that needs to be integrated into the JSoup code, so I don't need to use Document doc = Jsoup.connect (url) .get ();
thank
source
share