PHP code example of waavi / recaptcha

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

    

waavi / recaptcha example snippets


    'recaptcha' =>  'Your error message here',
    

    $value = \Input::get('g-recaptcha-response');
    $gResponse = \ReCaptcha::parseInput($value);

    if ($gResponse->isSuccess()) {
        return true;
    }
    else {
        $errors = $gResponse->getErrorMessages();   // Returns an array of error messages in the form of errorCode => errorMessage
        var_dump($errors);
    }
    

    $rules = [
        /** Your rules ... **/
        'g-recaptcha-response' => 'recaptcha',
    ];