WebClient webClient = new WebClient(); Page page = webClient.getPage("http://example.com"); WebResponse response = page.getWebResponse(); String content = response.getContentAsString();
API:
http://htmlunit.sourceforge.net/apidocs/com/gargoylesoftware/htmlunit/WebResponse.html#getContentAsString%28%29