reCAPTCHA Example

reCAPTCHA Example

Add your keys

If you do not have keys already then visit

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!


That’s it. Everything is working. Go integrate this into your real project.

Try again

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.

Try again

Complete the reCAPTCHA then submit the form.

An example form

Example input A:

Example input B: