PHP code example of devstrefa / recaptcha
1. Go to this page and download the library: Download devstrefa/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/ */
devstrefa / recaptcha example snippets
use \DevStrefa\ReCaptcha\ReCaptcha;
use \DevStrefa\ReCaptcha\Senders\FgcSender;
$reCaptcha = new ReCaptcha('secret_key_here', new FgcSender());
$reCaptcha->setResponse($_POST['g-recaptcha-response']);
$response=$reCaptcha->verify();
if ($response->isSuccess())
{
echo 'OK';
}
else
{
echo 'Error';
}