title: Submit a form using POST with g-recaptcha-response argument
body: <p>I want to submit a form from following web page: <a href="http://www.hzzo-net.hr/statos_OIB.htm" rel="noreferrer">http://www.hzzo-net.hr/statos_OIB.htm</a></p>
  
  <p>First, I use 2captcha service to bypass recaptcha:</p>
  
  <pre><code># parameters
  api_key &lt;- "c+++"
  api_url &lt;- "http://2captcha.com/in.php"
  site_key &lt;- "6Lc3SAgUAAAAALFnYxUbXlcJ8I9grvAPC6LFTKQs"
  hzzo_url &lt;- "http://www.hzzo-net.hr/statos_OIB.htm"
  
  # GET method
  req_url &lt;- paste0("http://2captcha.com/in.php?key=", api_key,"&amp;method=userrecaptcha&amp;googlekey=", 
                    site_key, "&amp;pageurl=", hzzo_url)
  get_response &lt;- POST(req_url)
  hzzo_content &lt;- content(get_response)
  hzzo_content &lt;- xml_text(hzzo_content)
  captcha_id &lt;- stringr::str_extract_all(hzzo_content[[1]], "\\d+")[[1]]
  
  # solve captcha
  Sys.sleep(16L)
  captcha2_solve &lt;- function(apiKey, capstchaID){
    req_url &lt;- paste0("http://2captcha.com/res.php?key=", api_key,"&amp;action=get&amp;id=", capstchaID)
    result &lt;- GET(req_url)
    captcha_content &lt;- content(result)
    hzzo_response &lt;- xml_text(captcha_content)
    hzzo_response &lt;- strsplit(hzzo_response, "\\|")
    return(hzzo_response)
    # hzzo_response &lt;- hzzo_response[[1]][[2]]
    # return(hzzo_response)
  }
  hzzo_response &lt;- captcha2_solve(api_key, captcha_id)
  while(hzzo_response[[1]] == "CAPCHA_NOT_READY"){
    Sys.sleep(16L)
    hzzo_response &lt;- captcha2_solve(api_key, captcha_id)
    return(hzzo_response)
  }
  hzzo_response &lt;- hzzo_response[[1]][[2]]
  </code></pre>
  
  <p>After executing this code I got the response that I have enter to textarea of recaptcha. This part works fine, as I expected. The response looks like this:</p>
  
  <pre><code>"03AHqfIOmo9BlCsCKyg-lDes4oW-U3PWgCtATRUqXFcEV032acDgGoOzrV8GiZNDzCF4TbCVLcY8HZ8hR1JqO11YdRExvgPDL0EUsjCZdI0rUm_LnBRRifyb66X7V6r4n8CIm1si3EKmw36XIcZK7MGrHSNWRrj2aGzWAYO8ceobViOICOhkYe9Bsfv64tUHWvHSqNIoesD_FHplbWG3B0eMag5341NyycjpNLxgNCwVzA8mhCU3oQUcloze-mIclFMZ7J_nbVhXdy8-qipF5ZFH4xIhSQXHH-TqxyaGQFjKdgLch7MuDEQVRcQGo1o4QuSEoeCTjlPn3Mah5vC8zKrnqfbMgiOVOIDJFGvFY4KOivbBzYTz5nW9g"
  </code></pre>
  
  <p>After that, I should submit the form. This is the part I can't get right.</p>
  
  <p>I tried to add all arguments to POST:</p>
  
  <pre><code>parameters &lt;- list(
    'upoib' = "93335620125", # example of number to enter
    'g-recaptcha-response' = hzzo_response
  )
  
  test &lt;- POST(
    "http://www.hzzo-net.hr/statos_OIB.htm",
    body = toJSON(parameters), 
    encode = "json",
    verbose()
  )
  </code></pre>
  
  <p>but this just give me the initial page.</p>
  
  <p>How can I submit the form if I have the recaptcha response variable? Is it possible to submit it with httr package or I have to use Selenium. The code can be in R or Python (just need the last part, POST function). </p>