Documentation

RecaptchaValidator
in package

Validates Google reCAPTCHA v2 responses via the siteverify API.

Tags
version
1.0.0

Table of Contents

Constants

TIMEOUT_SECONDS  = 3
VERIFY_URL  = 'https://www.google.com/recaptcha/api/siteverify'

Methods

validate()  : bool
Validate a reCAPTCHA response token

Constants

VERIFY_URL

private mixed VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'

Methods

validate()

Validate a reCAPTCHA response token

public validate(string $token[, string $clientIp = '' ]) : bool
Parameters
$token : string

The g-recaptcha-response value from the form

$clientIp : string = ''

The client IP address (optional, sent to Google)

Return values
bool

True if Google confirms the token is valid


        
On this page

Search results