reCAPTCHA Example
Add your keys
If you do not have keys already then visit
https://www.google.com/recaptcha/admin to generate them.
Edit this file and set the respective keys in $siteKey and
$secret. Reload the page after this.
POST data
verify($_POST[‘g-recaptcha-response’], $_SERVER[‘REMOTE_ADDR’]);
if ($resp->isSuccess()):
// If the response is a success, that’s it!
?>
Success!
That’s it. Everything is working. Go integrate this into your real project.
Something went wrong
The following error was returned: getErrorCodes() as $code) {
echo ‘' , $code , ' ‘;
}
?>
Check the error code reference at https://developers.google.com/recaptcha/docs/verify#error-code-reference.
Note: Error code missing-input-response may mean the user just didn’t complete the reCAPTCHA.
Complete the reCAPTCHA then submit the form.