PHP code example of neverbehave / hcaptcha

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

    

neverbehave / hcaptcha example snippets


$hcaptcha = new neverbehave\Hcaptcha('Your API KEY');

// Generate Challenge
// Instance of HcaptchaResponse
$client_challenge1 = $hcaptcha->challenge('Response');
$client_challenge2 = $hcaptcha->challenge('Another Response', 'Client IP');

// Read Result
if ($client_challenge1->isSuccess()) {
    // Do Something
} else {
    // Read Error
    $client_challenge1->getErrors();
}

// Get Raw Response 
$client_challenge2->getRaw();