Adding Google recaptcha to Java Swing

Alanic

New member
I'm doing a swing client to connect on a site, but it have a recaptcha. So I'd like to grab this recaptcha and put on my application, maybe on a webview, so the user can make it.

To manage that, I make a GET request to the site where the captcha are and get the data-sitekey, send this key to my server and generate a simple htlm, which is sent back to the client to show the captcha on the webview.

Here is the simple htlm which is sent to the client:
Code:
    <html>
<head>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src='http://www.google.com/recaptcha/api.js'></script>
</head>
    <body>
       <form action="hello" method="POST">
             <div class="g-recaptcha"
                    data-sitekey="api_key"
                    data-callback="onSuccess">
             </div>
             <br/>
       </form>
    </body>
<script>
    var onSuccess = function(response) {
          alert(grecaptcha.getResponse());
    };
    function clickCaptcha() {
        $("#recaptcha-anchor").click();
        $(".recaptcha-checkbox-checkmark").click();
    }
</script>
</html>

Thesting it with Googles's recaptcha demo page (https://www.google.com/recaptcha/api2/demo) it was working just fine, but when I got the target syte data-key, it gives an error: "invalid domain for the site key"

Just wondering how does 2captcha service, for example, can get the captcha and send to other person to solve it?

EDIT: When you create your data-sitekey to use recaptcha on your site, you should tell in which domain it will work. I tryed to fake the domain by modifying requet's headers (Host, Referer and Origin), but didn't work as well.

Thanks