google recaptcha V2: How to get it to work with SSL

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
krot
Forum Newbie
Posts: 15
Joined: Sun Nov 23, 2014 9:26 am

google recaptcha V2: How to get it to work with SSL

Post by krot »

I implemented google's reCAPTCHA V2 on [url]http://[/url] and it worked 100%. I then changed the protocol to my shared server SSL using the same script as the non-SSL script. The older version of reCaptcha had an SSL 'false' to 'true' SSL parameter, whereas I can't find one for V2. I had to use htaccess to redirect the example.com to the shared SSL server https://serverid.net/example/ which works perfectly without recCAPTCHA. I incorporated reCAPTCHA V2 and the error message where the reCAPTCHA image should be shows "ERROR: Invalid domain for site key".

Here's the recaptchalib.php code in case that helps:
https://github.com/google/ReCAPTCHA/blo ... chalib.php

Anyone know how to make this work?
Post Reply