I need your help regarding reCaptcha. Recaptcha works well on localhost, but when I try accessing it from a different machine it gives me this error
ERROR:Invalid domain for site key
yet I am using the same keys generated from reCaptcha site
I need your help regarding reCaptcha. Recaptcha works well on localhost, but when I try accessing it from a different machine it gives me this error
ERROR:Invalid domain for site key
yet I am using the same keys generated from reCaptcha site
The fix is go to https://www.google.com/recaptcha/admin and register your domain .It will work. Cheers .
If you try to access it from outside, the google (all of the net) sees your external computer IP (IP of your comp in the www) unrelated to
127.162.0.0
. So that's why it throws the error.I recommend you to set reCaptcha into a real web page and register at google.
If you want to run reCaptcha on localhost you should use secure token like described here: google secure token documentation this solved my own localhost problem. Previously I had an error message "Invalid domain for site key". This may be because nobody says that a localhost has to be named 'localhost' or have the standard IP used for localhosts. Anyways using the secure token solved this completely.
For secure token generation I'm using slushie's php implementation
The PHP part:
The HTML: