PHP code example of matt-west / craft-recaptcha
1. Go to this page and download the library: Download matt-west/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/ */
matt-west / craft-recaptcha example snippets
// Get the reCAPTCHA response code to validate.
$captcha = Craft::$app->getRequest()->getParam('g-recaptcha-response');
// Pass the response code to the verification service.
$validates = CraftRecaptcha::$plugin->craftRecaptchaService->verify($captcha);
if ($validates) {
// All good! the reCAPTCHA is valid.
} else {
// The reCAPTCHA is invalid.
}