Note: reCAPTCHA tokens expire after two minutes. If you're protecting an action with reCAPTCHA, make sure to call execute when the user takes the action
by the way, a wee tip, make sure this is on an HTTPS domain or the console log part wont work, It was doing my head in for ages until we figured that out.
This was helpful but aren't you missing the most important point: You save to the database based on the score you receive not based on success == true. Without taking the score into account you will essentially just allow every entry to be saved to the database regardless if it is classified as bot or not.
Hello, I am not a programmer and I was creating my web page, which has a form. I was looking at the option of placing a recaptcha, since I get a lot of spam. I found interesting the example that was made and I copied it completely, I put the keys and when I tested it, it does not work. I made it print the $response, but it does not show anything....ya q with values or without them, it indicates that it is not a human. The line that seems to be the problem is: $response = file_get_contents($url, false, $context); Unless, the problem is in the programming raised. I don't know if you have checked it or where the problem could be.... thanks for your help
I have integrated as you explained. I will observe and let to know result. Before I implement code I was receiving hundreds of SPAM registration every day! Thank you for great explanation.
Hello ! Recaptcha should ask for clicking on Recaptch button before submission & here why it didn't asked. Also let me know does recaptcha comes only on multiple visits by a user from an IP address ? Appreciation in advance for correct answes.
hey, I am able to console.log the token, but for some reason the g-recaptcha-response always shows up as empty in my backend ( verify.php). I have looked everywhere but am unable to find an answer. Can you help?
Can I leave the form in an or do I have to put it on the contact page itself? Also there is a lot of imput questions on this form and 2 minutes may not be enough for the token. If I use v2 checkbox or invisible, would that be better for all the questions, with or without .
Hello, in the console I didn't see the token, I've got some errors. I did all Failed to load resource: the server responded with a status of 404 (Not Found) recaptcha__es.js:516 Uncaught (in promise) Error: Invalid site key or not loaded in api.js: your_site_key_here at pl (recaptcha__es.js:516) at Object.IN [as execute] (recaptcha__es.js:521) at (index):66 bootstrap.min.css:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Absolutely new to php and using this tutorial to add recaptcha to my clients website. However it’s still not live yet. Does the website need to be hosted to check if this code is working? Right now I’m adding this code to the website code and I’m seeing all the php code on top of the page when I open it on the browser. Is this because I’m not host it on a server?
Hey, can you help me I have an error. When I run this '''json_decode($response, true);''' I get this result: Array ( [success] => [error-codes] => Array ( [0] => missing-input-response [1] => missing-input-secret ) ) And you didn't get this error.
Probably the if(isset($_POST['post'])) check is resulting in false to its not executing the if block, which could be because you may not be sending anything for post key.
The checkbox is only displayed in V2 of the Recaptcha, in V3, it is purely behind the scene, analyzing stuff like mouse movement, page scroll, and other interactions.