I am having a problem setting up the code to verify the user's response after checking the recaptcha box.
I am using this example code:
https://github.com/google/ReCAPTCHA/blob/master/php/example-captcha.phpBy itself, $_POST['g-recaptcha-response'] returns a long string of letters and numbers. So far so good.
But when I use the following code from the example:
196
// Was there a reCAPTCHA response?197 if ($_POST["g-recaptcha-response"]) {
|
| 198 $resp = $reCaptcha->verifyResponse( |
| 199 $_SERVER["REMOTE_ADDR"], |
| 200 $_POST["g-recaptcha-response"] |
| 201 ); |
| 202 } |
I get the following errors:
Notice: Undefined variable: reCaptcha in
[program name] on line
198
Fatal error: Call to a member function verifyResponse() on a non-object in
[program name] on line
198
Please tell me how to fix this.