EDIT - it's an IPv6 issue
I've narrowed it down to that. details are here: Google Recaptcha check timeout due to IPv6 issue - php on IIS Thank you.
Original Question:
Google Recaptcha v2 has stopped working on a pile of my websites over the past 2 days, even though we've not made any changes to the code.
I check if the recaptcha has been entered correctly via php:
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']);
$response = json_decode($response, true);
if($response["success"] !== true){
header('HTTP/1.1 403 Recaptcha Incorrect');
exit("The recaptcha was entered incorrectly. Please try again.");
};
Over the past 2 days it's stopped working. When not working google's servers appear to not be responding at all to the request made in the above code. I've not seen it come back as fail. It's just doesn't respond.
My VPS cannot communicate with google's servers?
It appears as if my VPS has suddenly stopped being able to communicate with google recaptcha servers:
- I have not made any changes to the code.
- It's been working inconsistently
- The recaptcha works fine when I test it locally
- The recaptcha works fine when I put the website on a test domain on azure (my VPS is not on azure).
Any ideas where I should start to fix this?
All ideas greatly appreciated as I'm at a loss as where to even look to get it working.
thanks.