I am trying to implement Google ReCAPTCHA on my website form. The following code below recognizes when the ReCAPTCHA is not completed, but when it is completed and I submit my form, it doesn't do anything.
My form does submit without the ReCAPTCHA implemented. I am not very good with php in the first place so that is why I came here for help.
Thank you!
if (isset($_POST['g-recaptcha-response'])) {
require('component/recaptcha/src/autoload.php');
$recaptcha = new \ReCaptcha\ReCaptcha("6Le8bIEUA************QgWpA", new \ReCaptcha\RequestMethod\SocketPost());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if (!$resp->isSuccess()) {
$output = json_encode(array('type'=>'error', 'text' => '<b>Captcha</b> Validation Required!'));
die($output);
}
}
I need my ReCAPTCHA to send an email once it is verified that it was clicked on. It only tells me when it hasn't been clicked on. The email just doesn't get sent.
Without the ReCAPTCHA the form works fine.