PHP code example of enunez / grecaptcha-validator

1. Go to this page and download the library: Download enunez/grecaptcha-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

enunez / grecaptcha-validator example snippets


$captcha = Builder::getInstance(YOUR_SHARED_KEY, USER_RESPONSE_TOKEN)->build();

$captcha->isValid();

$captcha = Builder::getInstance(YOUR_SHARED_KEY, USER_RESPONSE_TOKEN)->remoteIp(REMOTE_IP)->build();

$captcha->isValid();

if (!$captcha->isValid()) {
    foreach ($errorCode as $captcha->errorCodes()) {
        // processing the error code
    }
}