I have been having this issue for a while and I cant figure it out. My Google recaptcha code seems to work on some websites - but the exact same code when added to other websites (or even other pages within the same website) won't work. When it doesn't work, if I do a var_dump($_POST['g-recaptcha-response']); (on the second page) I get NULL.
My initial/form code:
<script src='https://www.google.com/recaptcha/api.js'></script>
<div class="g-recaptcha" data-sitekey="xxxxx"></div>
My verification page code:
$gRecaptcha = $_POST['g-recaptcha-response'];
$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=xxxxx&response=".$gRecaptcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
if($response.success==false || !$gRecaptcha){
die('xxxx');
}
There are other's that posted this question as well, but it doesn't seem any of them have a solution posted (they all just switched to a different captcha). Any suggestions what to check next?