PHP code example of hostily / captcha
1. Go to this page and download the library: Download hostily/captcha 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/ */
hostily / captcha example snippets
use Hostily\Captcha\Client;
use Hostily\Captcha\UnavailableException;
$captcha = new Client(getenv('HOSTILY_CAPTCHA_SECRET')); // Secret nur auf dem Server!
try {
$result = $captcha->verifyForm($_POST, $_SERVER['REMOTE_ADDR'] ?? null);
} catch (UnavailableException $e) {
// Dienst nicht erreichbar / Zeitlimit: Sie entscheiden - blockieren oder durchlassen
}
if ($result->success) { /* annehmen */ } else { /* $result->gruende, $result->punkte */ }