himiklab\yii2\recaptcha\ReCaptchaValidator::validateValue PHP Method

validateValue() protected method

protected validateValue ( string $value ) : array | null
$value string
return array | null
    protected function validateValue($value)
    {
        if (empty($value)) {
            if (!($value = Yii::$app->request->post(self::CAPTCHA_RESPONSE_FIELD))) {
                return [$this->message, []];
            }
        }
        $request = self::SITE_VERIFY_URL . '?' . http_build_query(['secret' => $this->secret, 'response' => $value, 'remoteip' => Yii::$app->request->userIP]);
        $response = $this->getResponse($request);
        if (!isset($response['success'])) {
            throw new Exception('Invalid recaptcha verify response.');
        }
        return $response['success'] ? null : [$this->message, []];
    }