如何修复recaptcha错误?

时间:2016-08-27 23:54:45

标签: html captcha recaptcha

我有一个sitekey,我想在本地重现验证码。但是,当我打开html时,它表示sitekey的域名无效。

这是我的html文件中的代码:

    <script type='text/javascript' src='https://www.google.com/recaptcha/api.js'></script>
    </head>
    <body>

    <form method="post" action="you cannot see this link">
    <input type="text" placeholder="productcode_size" name="pid">
    <input type="text" placeholder="productcode" name="masterPid">
    <input type="hidden" value="1" name="Quantity">
    <input type="hidden" value="" name="x-PrdRtt" id="captcha_val">

    <input type="hidden" value="Add To Bag overlay" name="layer">
    <input type="hidden" name="ajax" value="true">
    <br>
    <br>

    <br>
    <br>
    <div style="opacity: 0.3" class="g-recaptcha" data-sitekey="you cannot see this sitekey"></div>

    <br>

    <div class="contionue-shopping-wrapper">
    <form class="co-formcontinueshopping" action="You cannot see this link" method="post" id="dwfrm_cart_d0ffhvzsobkp">
    <fieldset>
    <button class="rbk-button-red button-primary bp-black right" type="submit" value="Continue Shopping" name="dwfrm_cart_continueShopping">
    <span>Continue Shopping</span>
    </button>
    </fieldset>
    </form>
    </div>

    </form>
<script>

    check = setInterval(function() {
        v = document.getElementById('g-recaptcha-response').value
        if (v.length > 0) {
            var r = '&x-PrdRtt='+v+'"">ATC Link</a>';
           document.getElementById('captcha_val').value = v
            var sz = document.getElementById('sz').value;
            var pid = '?ajax=true&pid='+sz;

            document.getElementById('hack').innerHTML = '<a href="'+document.forms[0].action+pid+r;


            clearInterval(check);
        }
    }, 400)


</script>

</body>
</html>

有人可以帮我解决这个问题吗?我希望能够在本地完成验证码以提取验证码响应。

1 个答案:

答案 0 :(得分:0)

根据此页面https://developers.google.com/recaptcha/docs/start

    If you would like to use "localhost" for development,
    you must add it to the list of domains.

所以只需添加"localhost" (or "127.0.0.1"),这应该适合您。