PHP code example of davidvandertuijn / recaptcha
1. Go to this page and download the library: Download davidvandertuijn/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/ */
davidvandertuijn / recaptcha example snippets
use Davidvandertuijn\Recaptcha;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$recaptcha = new Recaptcha;
$recaptcha->setSecret('your-secret-key-here');
$recaptcha->setResponse($_POST['g-recaptcha-response']);
$recaptcha->setRemoteIp($_SERVER['REMOTE_ADDR']);
if (!$recaptcha->verify()) {
// false
} else {
// true
}
}