ReCaptcha
reCAPTCHA client.
Table of Contents
Constants
- MODULE_ID = 'crm'
- OPTION_NAME = 'crm_recaptcha'
- VERSION = 'php_1.1.2'
- Version of this client library.
Methods
- __construct() : mixed
- Create a configured instance to use the reCAPTCHA service.
- getDefaultKey() : string
- Get default key.
- getDefaultSecret() : string
- Get default secret.
- getError() : string
- Return error code.
- getJavascriptResource() : string
- Get default key.
- getKey() : string
- Get key.
- getSecret() : string
- Get secret.
- setKey() : void
- Set key & secret.
- verify() : bool
- Calls the reCAPTCHA siteverify API to verify whether the user passes CAPTCHA test.
Constants
MODULE_ID
public
mixed
MODULE_ID
= 'crm'
OPTION_NAME
public
mixed
OPTION_NAME
= 'crm_recaptcha'
VERSION
Version of this client library.
public
mixed
VERSION
= 'php_1.1.2'
Tags
Methods
__construct()
Create a configured instance to use the reCAPTCHA service.
public
__construct(string $secret[, HttpClient $httpClient = null ]) : mixed
Parameters
- $secret : string
-
shared secret between site and reCAPTCHA server.
- $httpClient : HttpClient = null
-
method used to send the request. Defaults to POST.
Tags
getDefaultKey()
Get default key.
public
static getDefaultKey([string $version = '' ]) : string
Parameters
- $version : string = ''
-
Version.
Return values
stringgetDefaultSecret()
Get default secret.
public
static getDefaultSecret([string $version = '' ]) : string
Parameters
- $version : string = ''
-
Version.
Return values
stringgetError()
Return error code.
public
getError() : string
Return values
stringgetJavascriptResource()
Get default key.
public
static getJavascriptResource([mixed $lang = LANGUAGE_ID ]) : string
Parameters
- $lang : mixed = LANGUAGE_ID
Return values
stringgetKey()
Get key.
public
static getKey([string $version = '' ]) : string
Parameters
- $version : string = ''
-
Version.
Return values
stringgetSecret()
Get secret.
public
static getSecret([string $version = '' ]) : string
Parameters
- $version : string = ''
-
Version.
Return values
stringsetKey()
Set key & secret.
public
static setKey(string $key, string $secret[, string $version = '' ]) : void
Parameters
- $key : string
-
Key.
- $secret : string
-
Secret.
- $version : string = ''
-
Version.
verify()
Calls the reCAPTCHA siteverify API to verify whether the user passes CAPTCHA test.
public
verify(string $response[, string $remoteIp = null ]) : bool
Parameters
- $response : string
-
The value of 'g-recaptcha-response' in the submitted form.
- $remoteIp : string = null
-
The end user's IP address.
Return values
bool —Verifying result.