title: Java - Sending a post request with HtmlUnit
body: <p>Can't really find any help on this but I've been trying to send a post request with HtmlUnit. The code I have is:</p>
  
  <pre><code>final WebClient webClient = new WebClient();
  
  // Instead of requesting the page directly we create a WebRequestSettings object
  WebRequest requestSettings = new WebRequest(
    new URL("www.URLHERE.com"), HttpMethod.POST);
  
  // Then we set the request parameters
  requestSettings.setRequestParameters(new ArrayList());
  requestSettings.getRequestParameters().add(new NameValuePair("name", "value"));
  // Finally, we can get the page
  HtmlPage page = webClient.getPage(requestSettings);
  </code></pre>
  
  <p>Is there an easier way I could carry out a POST request?</p>