PHP code example of c10d / craft-recaptcha
1. Go to this page and download the library: Download c10d/craft-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/ */
c10d / craft-recaptcha example snippets
use c10d\craftrecaptcha\CraftRecaptcha;
// [ ... ]
$captcha = Craft::$app->getRequest()->getParam('g-recaptcha-response');
$isValid = CraftRecaptcha::$plugin->recaptcha->verify($captcha);
if (!$isValid) {
// ERROR: you can push an error here
}