support

reCAPTCHA Human verification has failed! Please try again. 2022

Started by kavlito, July 15, 2022, 05:59:04 PM

Previous topic - Next topic

kavlito

Recently, customers have been calling because they cannot create an account due to reCAPTCHA Human verification has failed! Please try again. error message. I've had this problem exactly 2 years ago and created new keys and it resolved the problem. However, this time it is not.

I assume that something changed on Google's end. I currently have to leave human verification turned off just to receive orders.

What can be done?

Thanks in advance.

llegrand

what cart version are you using?

here is the latest from AbanteCart regarding reCaptcha

https://abantecart.atlassian.net/wiki/spaces/AD/pages/6258768/Google+reCAPTCHA

Please note there are two version of it now,  v2 and v3 from Google and they are a bit different

This from Google - at the bottom of the page compares v2 and v3 which might be useful to you to make a decision.
https://www.google.com/recaptcha/about/

kavlito

This has absolutely never worked. I have everything set up correctly (created over a dozen keys both v2 & v3 - it's not that difficult) and still get the error message: Human verification has failed! Please try again.

Error log shows: warning: AbanteCart core v.1.2.16 file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: no suitable wrapper could be found in <b>/home/domain/public_html/core/vendors/google_recaptcha/ReCaptcha/RequestMethod/Post.php</b> on line <b>80</b>

kavlito

#3
I used ChatGPT to resolve this based on the error log msg. In my case, it was due to 'allow_url_fopen' not being enabled in my servers PHP settings.

QuoteCHATGPT RESPONSE:

Ahhh, perfect – that error log is the smoking gun.

file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: no suitable wrapper could be found

That means:

👉 Your AbanteCart + reCAPTCHA setup is basically fine.
👉 The problem is your server's PHP config can't make HTTPS requests.

So it's not the keys, not the domains, not v2 vs v3. It's PHP.

1. What "no suitable wrapper could be found" actually means

In PHP, file_get_contents() can fetch URLs only if:

allow_url_fopen is On, and

The https stream wrapper is available (usually via the openssl extension).

If either is missing/disabled, PHP can't handle https://... URLs, and you get exactly:

no suitable wrapper could be found

So AbanteCart is trying to call Google here:

https://www.google.com/recaptcha/api/siteverify


...but PHP doesn't know how to speak HTTPS from that environment.

2. The real fix: enable HTTPS URL support in PHP

Since you're on /home/domain/public_html/..., this is almost certainly a cPanel/shared-host style setup.

Step A – Check your PHP configuration

Option 1: From AbanteCart (if phpinfo is available)
Sometimes under System → Engine → Tools or similar, there's a "PHP Info" link.
If you see it:

Open phpinfo.

Look for:

allow_url_fopen → should be On

openssl section → should exist and be enabled

Option 2: Via a tiny phpinfo file

In public_html/, create a file called phpinfo.php with:

<?php phpinfo();


Visit https://domain.com/phpinfo.php

Check:

allow_url_fopen

openssl extension

Registered stream wrappers – you should see https listed.

Delete phpinfo.php when you're done (don't leave it live).

Step B – Turn things ON in cPanel

Log into cPanel for this account:

Go to Select PHP Version or MultiPHP INI Editor (depends on host).

Make sure:

PHP version is reasonably recent (e.g., 7.4 / 8.0 / 8.1, not something ancient).

Extensions: check the box for openssl.

In MultiPHP INI Editor (or similar), ensure:

allow_url_fopen = On


Save / Apply changes.

Clear AbanteCart cache (from admin).

Test your form again.

If you don't see those controls, or they're locked, just send this exact text to your host:

"My PHP error log shows:
file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: no suitable wrapper could be found

Please enable the PHP https stream wrapper for this account (ensure allow_url_fopen is On and the openssl extension is enabled), so file_get_contents can access HTTPS URLs."

Once they enable that, reCAPTCHA will start validating properly.

3. Optional workaround: use cURL instead of file_get_contents

Only if your host refuses to enable allow_url_fopen or https wrappers, you can hack around it by switching the reCAPTCHA library to use cURL (if cURL is available).

Look at:

/core/vendors/google_recaptcha/ReCaptcha/RequestMethod/Post.php
/core/vendors/google_recaptcha/ReCaptcha/RequestMethod/CurlPost.php  (if present)


In some versions of the official Google library, the main ReCaptcha class chooses cURL automatically when available. If AbanteCart's version is forcing Post (file_get_contents) instead of CurlPost, you could:

Change the code that instantiates RequestMethod\Post to RequestMethod\CurlPost (assuming the file exists and cURL is enabled).

But honestly:
✅ The clean, future-proof solution is to fix PHP config on the server.
That way other things (payments, external APIs, etc.) also work correctly.

4. Summary / what you should do next

Stop worrying about keys/domains – they're not the issue now.

Fix PHP https support:

Ensure allow_url_fopen = On

Ensure openssl is enabled

Confirm https appears in PHP stream wrappers

Retest the form after AbanteCart cache clear.

If you'd like, paste back a couple of lines from your phpinfo (just the bits for allow_url_fopen and whether openssl shows up), and I can confirm if the server is configured correctly.

Basara


Forum Rules Code of conduct
AbanteCart.com 2010 -