PHP code example of rubensrocha / h-captcha

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

    

rubensrocha / h-captcha example snippets


Rubensrocha\HCaptcha\HCaptchaServiceProvider::class,

'HCaptcha' => Rubensrocha\HCaptcha\Facades\HCaptcha::class,

 {!! HCaptcha::renderJs() !!}

 {!! HCaptcha::renderJs('fr', true, 'recaptchaCallback') !!}

{!! HCaptcha::display() !!}

{!! HCaptcha::display(['data-theme' => 'dark']) !!}

{!! HCaptcha::displaySubmit('my-form-id', 'submit now!', ['data-theme' => 'dark']) !!}

$validate = Validator::make(Input::all(), [
	'h-captcha-response' => '

'custom' => [
    'h-captcha-response' => [
        ' or contact site admin.',
    ],
],

@if ($errors->has('h-captcha-response'))
    <span class="help-block">
        <strong>{{ $errors->first('h-captcha-response') }}</strong>
    </span>
@endif

// prevent validation error on captcha
HCaptcha::shouldReceive('verifyResponse')
    ->once()
    ->andReturn(true);

// provide hidden input for your '

// prevent validation error on captcha
HCaptcha::shouldReceive('verifyResponse')
    ->once()
    ->andReturn(true);

// POST request, with request body including g-recaptcha-response
$response = $this->json('POST', '/register', [
    'h-captcha-response' => '1',
    'name' => 'John',
    'email' => '[email protected]',
    'password' => '123456',
    'password_confirmation' => '123456',
]);



et  = 'CAPTCHA-SECRET';
$sitekey = 'CAPTCHA-SITEKEY';
$captcha = new \Rubensrocha\HCaptcha\HCaptcha($secret, $sitekey);

if (! empty($_POST)) {
    var_dump($captcha->verifyResponse($_POST['h-captcha-response']));
    exit();
}

ssh
php artisan vendor:publish --provider="Rubensrocha\HCaptcha\HCaptchaServiceProvider"