PHP code example of wobeto / google-recaptcha-checkbox

1. Go to this page and download the library: Download wobeto/google-recaptcha-checkbox 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/ */

    

wobeto / google-recaptcha-checkbox example snippets




obeto\GoogleRecaptchaCheckbox\Recaptcha;

try {
    $secret = '4Lchd-IvAAeAAIWBvzYvAEKu1chTimd0HJroP9T4';
    
    $recaptcha = new Recaptcha($secret);

    $verify = $recaptcha->verify($_POST['g-recaptcha-response']);

    var_dump($verify); //true
} catch (Exception $e) {
    echo $e->getMessage();
}