1. Go to this page and download the library: Download holduix/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/ */
holduix / recaptcha example snippets
use Holduix\Component\reCAPTCHA;
$reCAPTCHA = new reCAPTCHA('your-site-key', 'your-secret-key', 'v2'); // or 'v3' for reCAPTCHA v3
use Holduix\Component\reCAPTCHA;
$reCAPTCHA = new reCAPTCHA();
$reCAPTCHA->setSiteKey('your-site-key');
$reCAPTCHA->setSecretKey('your-secret-key');
$reCAPTCHA->setVersion('v2'); // or 'v3' for reCAPTCHA v3
echo $reCAPTCHA->getScript();
echo $reCAPTCHA->getHtml();
if ($reCAPTCHA->isValid($_POST['g-recaptcha-response'])) {
// Le captcha est valide
echo "Captcha valide !";
} else {
// Afficher les erreurs
var_dump($reCAPTCHA->getErrorCodes());
}
echo $reCAPTCHA->getScript();
echo $reCAPTCHA->getHtml();
if ($reCAPTCHA->isValid($_POST['g-recaptcha-response'])) {
// Le captcha est valide
echo "Captcha valide !";
} else {
// Afficher les erreurs
var_dump($reCAPTCHA->getErrorCodes());
}