PHP code example of infopeak / captcha

1. Go to this page and download the library: Download infopeak/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/ */

    

infopeak / captcha example snippets


use InfoPeak\Captcha\Client;

$captcha = new Client('YOUR_SITEKEY', 'YOUR_SECRET');

if (!$captcha->verify($_POST[Client::FIELD] ?? '')) {
    http_response_code(400);
    exit('Captcha verification failed');
}
// ... proceed

$result = $captcha->verifyDetailed($_POST[Client::FIELD] ?? '');
$result->valid;     // bool - token genuine and unused
$result->overLimit; // bool - sitekey over its monthly quota