Forums

Google NoCaptcha - file_get_contents -> failed to open stream

damole 06 Jul, 2020
I have been testing NoCaptcha on a clean Joomla 3.8.12 site setup locally, I added localhost to my sites and got my test keys from Google.

The NoCaptcha loads OK and accepts my click but the check NoCaptcha fails with the following warnings:

Warning: failed loading cafile stream: `D:\xampp\apache\bin\curl-ca-bundle.crt' in D:\xampp\htdocs\chrono\administrator\components\com_chronoforms5\chronoforms\actions\check_nocaptcha\check_nocaptcha.php on line 29

Warning: file_get_contents(): Failed to enable crypto in D:\xampp\htdocs\chrono\administrator\components\com_chronoforms5\chronoforms\actions\check_nocaptcha\check_nocaptcha.php on line 29

Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=secret key&response): failed to open stream: operation failed in D:\xampp\htdocs\chrono\administrator\components\com_chronoforms5\chronoforms\actions\check_nocaptcha\check_nocaptcha.php on line 29


I watched the tutorials on YouTube and read a lot of posts with similar issues on these forums but I am not sure what to look at next.[file=13157]CFV5_FormsBackup_ON_http___localhost_06_Jul_2020_10_18_56.cf5bak[/file]
damole 06 Jul, 2020
This is what Google returns.

{
"success": true,
"challenge_ts": "2020-07-06T11:30:48Z",
"hostname": "localhost"
}
damole 06 Jul, 2020
I see but turning off warnings that they are not the issue.
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$config->get('secret_key')."&response=".$form->data('g-recaptcha-response'));
$response = json_decode($response, true);
print_r($response);
if($response["success"] === TRUE){
This should work with the above response.
GreyHead 07 Jul, 2020
Hi damole,

It looks as though the problems are with your localhost setup. I think that the first one maybe because cURL is not included/enabled in your PHP setup; the second may be because there is no SSL certificate installed. Not sure about the third one - maybe just that Google isn't returning the expected data.

Bob
damole 07 Jul, 2020
Hi

Thanks for the reply.

As soon as I tested on the live sit it worked fine.

It is an old site that is in the process of being relaunched so doesn't get much attention. The old ChronoForms 4 reCaptcha had stopped working so none of the contact forms could be submitted.

I was able to install the newer ChronoForms 5 extension and plugin alongside the older versions so it made it very easy to re-create all the forms once I had tested that reCaptcha was working.

Nice software, thanks.
This topic is locked and no more replies can be posted.