◆ __construct()
Create a configured instance to use the reCAPTCHA service.
- Paramètres
-
string | $secret | The shared key between your site and reCAPTCHA. |
RequestMethod | $requestMethod | method used to send the request. Defaults to POST. |
- Exceptions
-
◆ setChallengeTimeout()
setChallengeTimeout |
( |
|
$timeoutSeconds | ) |
|
Provide a timeout in seconds to test against the challenge timestamp in verify()
- Paramètres
-
int | $timeoutSeconds | Expected hostname |
- Renvoie
- ReCaptcha Current instance for fluent interface
Références $this.
◆ setExpectedAction()
setExpectedAction |
( |
|
$action | ) |
|
Provide an action to match against in verify() This should be set per page.
- Paramètres
-
string | $action | Expected action |
- Renvoie
- ReCaptcha Current instance for fluent interface
Références $this.
◆ setExpectedApkPackageName()
setExpectedApkPackageName |
( |
|
$apkPackageName | ) |
|
Provide an APK package name to match against in verify()
- Paramètres
-
string | $apkPackageName | Expected APK package name |
- Renvoie
- ReCaptcha Current instance for fluent interface
Références $this.
◆ setExpectedHostname()
setExpectedHostname |
( |
|
$hostname | ) |
|
Provide a hostname to match against in verify() This should be without a protocol or trailing slash, e.g. www.google.com
- Paramètres
-
string | $hostname | Expected hostname |
- Renvoie
- ReCaptcha Current instance for fluent interface
Références $this.
◆ setScoreThreshold()
setScoreThreshold |
( |
|
$threshold | ) |
|
Provide a threshold to meet or exceed in verify() Threshold should be a float between 0 and 1 which will be tested as response >= threshold.
- Paramètres
-
float | $threshold | Expected threshold |
- Renvoie
- ReCaptcha Current instance for fluent interface
Références $this.
◆ verify()
verify |
( |
|
$response, |
|
|
|
$remoteIp = null |
|
) |
| |
Calls the reCAPTCHA siteverify API to verify whether the user passes CAPTCHA test and additionally runs any specified additional checks
- Paramètres
-
string | $response | The user response token provided by reCAPTCHA, verifying the user on your site. |
string | $remoteIp | The end user's IP address. |
- Renvoie
- Response Response from the service.
Références $params, et Response\fromJson().
◆ $requestMethod
◆ $secret
◆ E_ACTION_MISMATCH
const E_ACTION_MISMATCH = 'action-mismatch' |
Expected action did not match string
◆ E_APK_PACKAGE_NAME_MISMATCH
const E_APK_PACKAGE_NAME_MISMATCH = 'apk_package_name-mismatch' |
Expected APK package name did not match string
◆ E_BAD_RESPONSE
const E_BAD_RESPONSE = 'bad-response' |
Did not receive a 200 from the service string
◆ E_CHALLENGE_TIMEOUT
const E_CHALLENGE_TIMEOUT = 'challenge-timeout' |
◆ E_CONNECTION_FAILED
const E_CONNECTION_FAILED = 'connection-failed' |
Could not connect to service string
◆ E_HOSTNAME_MISMATCH
const E_HOSTNAME_MISMATCH = 'hostname-mismatch' |
Expected hostname did not match string
◆ E_INVALID_JSON
const E_INVALID_JSON = 'invalid-json' |
Invalid JSON received string
◆ E_MISSING_INPUT_RESPONSE
const E_MISSING_INPUT_RESPONSE = 'missing-input-response' |
ReCAPTCHA response not provided string
◆ E_SCORE_THRESHOLD_NOT_MET
const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met' |
Score threshold not met string
◆ E_UNKNOWN_ERROR
const E_UNKNOWN_ERROR = 'unknown-error' |
Not a success, but no error codes received! string
◆ SITE_VERIFY_URL
const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify' |
◆ VERSION
const VERSION = 'php_1.2.4' |
Version of this client library. string
La documentation de cette classe a été générée à partir du fichier suivant :