I've this error on my program: Undefined property: stdClass::$score
This is my code:
protected function signinCaptcha():string|bool
{
//echo "test: -> "; var_dump($this->saveForm());exit;
if ($this->saveForm()):
//echo "test: -> "; var_dump($this->saveForm());exit;
$response = $this->signin['recaptcha_response'];
$secretKey ='XXXXXXXXXXXXXXXXXXXXXXXXXX';
// post request to server
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
$captcha = file_get_contents($recaptcha_url . "?secret=" . $secretKey . "&response=" . $response);
$captcha = json_decode($captcha);
if($captcha->score >= 0.5)
return true;
else
return false;
else:
return false;
endif;
}
Could anyone help me to understand where the cause of the problem lies and how to go about resolving it?