Open source reCAPTCHA alternative

Demo

Use

Put this in your page somewhere:
<script src="https://captcha.bka.li/captcheck.min.js"></script>
Put this in your form where you want the CAPTCHA:
<div class="captcheck_container"></div>
Put this in your server-side form validation (PHP example):

$url = 'https://captcha.bka.li/api.php';
$data = [
    'session_id' => $_POST['captcheck_session_code'],
    'answer_id'  => $_POST['captcheck_selected_answer'],
    'action'     => "verify"
];
$options = [
    'http' => [
        'header'  => "Content-type: application/x-www-form-urlencoded\r\n" .
                     "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0",
        'method'  => 'POST',
        'content' => http_build_query($data)
    ]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$resp = json_decode($result, TRUE);
if (!$resp['result']) {
    // Replace with error-handling code
    exit("CAPTCHA did not verify:" . $resp['msg']);
} else {
    // The CAPTCHA is valid.
    exit("CAPTCHA verified!");
}
Due to security settings on bka.li it is essential that a correct user agent is included at all times!

If you have a strict Content Security Policy, change your div to this:
<div class="captcheck_container" data-stylenonce="your nonce here"></div>
Note: by using this hosted service, you agree to our terms of service. If you don't like them, feel free to host Captcheck on your own server. Popular sites should self-host as well just to be nice.