PHP code example of seanhayes-com / laravel-hcaptcha

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

    

seanhayes-com / laravel-hcaptcha example snippets



$hcaptcha = new \HCaptcha\HCaptcha($secret);


$hcaptcha = new \HCaptcha\HCaptcha($secret);
$resp = $hcaptcha->setExpectedHostname('your-domain.com.here')
                  ->verify($HcaptchaResponse, $remoteIp);
if ($resp->isSuccess()) {
    // Verified!
} else {
    $errors = $resp->getErrorCodes();
}


$hcaptcha = new \HCaptcha\HCaptcha($secret);
$resp = $hcaptcha->setExpectedHostname('your-domain.com.here')
                  ->setExpectedAction('homepage')
                  ->setScoreThreshold(0.5)
                  ->verify($HcaptchaResponse, $remoteIp);

if ($resp->isSuccess()) {
    // Verified!
} else {
    $errors = $resp->getErrorCodes();
}