Google Recaptcha implementation - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, November 20, 2021

Google Recaptcha implementation

Im struggeling to enter the private key for reCaptcha v3. I have integrated in the Site-key into my html form:

<div id="recaptcha" class="g-recaptcha" data-sitekey="SITE KEY" data-callback="onSubmit" data-size="invisible"></div>

Now Im struggeling to enter the private key. I have a file called recaptchalib.php

Will it work if i enter the secret key like this:

class ReCaptchaResponse
{
    public $success;
    public $errorCodes;
}

class ReCaptcha
{
    private static $_signupUrl = "https://www.google.com/recaptcha/admin";
    private static $_siteVerifyUrl =
        "https://www.google.com/recaptcha/api/siteverify?";
    private $_secret ="INSERT SECRET KEY HERE";
    private static $_version = "php_1.0";

    /**
     * Constructor.
     *
     * @param string $secret shared secret between site and ReCAPTCHA server.
     */
    function ReCaptcha($secret)
    {
        if ($secret == null || $secret == "") {
            die("To use reCAPTCHA you must get an API key from <a href='"
                . self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
        }
        $this->_secret=$secret;
    }


source https://stackoverflow.com/questions/70037333/google-recaptcha-implementation

No comments:

Post a Comment