Page 1 of 1

Google ReCaptcha error

Posted: Wed May 23, 2018 9:08 am
by ozstar
HI,

Have installed Google ReCaptach and got keys.

After choosing it in Admin and testing the 'I am not a Robot' on the Contact page, I get this error at the top of the Contact page.
I get this at the ReCapture option after I hit Submit .

Verification is not correct.

Any help please?
Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/laybuy/public_html/catalog/controller/extension/captcha/google.php on line 27Warning: file_get_contents(https://www.google.com/recaptcha/api/si ... 53.210.129): failed to open stream: no suitable wrapper could be found in /home/laybuy/public_html/catalog/controller/extension/captcha/google.php on line 27

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 9:34 am
by yodapt
Try adding this to php.ini (should be a file in the root of your server, if not create it) :

Code: Select all

allow_url_fopen = ON
allow_url_include = ON
If it doesn't work, try adding this to the beggining of your index.php (and admin/index.php) :

Code: Select all

ini_set("allow_url_fopen", 1);
If none of the above works, contact your hosting company if they are willing to change that. If everything failed, contact a developer.

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 10:02 am
by ozstar
Thank you..Will give that a go.

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 3:27 pm
by ozstar
Hi,

I tried those additions to php.ini and the indexes but still got the same message.

Code: Select all

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/laybuy/public_html/catalog/controller/extension/captcha/google.php on line 27Warning: file_get_contents(https://www.google.com/recaptcha 
and

Code: Select all

 failed to open stream: no suitable wrapper could be found in /home/laybuy/public_html/catalog/controller/extension/captcha/google.php on line 27
Contacted Journal Theme support and they said it was nothing to do with the theme and it looked like a php problem.

I did see on the Google Captcha page to add these, but can't find the HTML file to add to and the form file.

Code: Select all

Paste this snippet before the closing </head> tag on your HTML template:
<script src='https://www.google.com/recaptcha/api.js'></script>
Paste this snippet at the end of the <form> where you want the reCAPTCHA widget to appear:
<div class="g-recaptcha" data-sitekey="6LdvkVoUAAAAAJ31wsqEfXQXcJ6_1WuRQ0vJKu4s"></div>

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 4:43 pm
by yodapt
Either you contact your host about allowing allow_url_fopen on PHP, or contact a developer to fix that for you. If your host is shared, odds are they will not comply.

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 5:47 pm
by ozstar
Hi,

That is already in.

See here on both root and admin files.

php.ini - root

Code: Select all

session.cookie_httponly = On;
session.gc_maxlifetime = 172800;
allow_url_fopen = on;
;display_errors = 1;
;error_reporting = E_ALL;

in admin

Code: Select all

session.use_cookies = On;
session.use_trans_sid = Off;
session.gc_maxlifetime = 12000000;
allow_url_fopen = on;
This is line 27 on google.php

Code: Select all

$recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('captcha_google_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']);
There must be something else, causing the error, yes? ???

Thanks for the help.

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 7:40 pm
by ocguru
Hi,
The issue is most shared hosting not allow to use file_get_contents function and this will be Disabled on your server too.
So you have to use CURL instead of file_get_contents().
Thanks

Re: Google ReCaptcha error

Posted: Wed May 23, 2018 9:45 pm
by ozstar
Thank you guys. Problem Solved

It seems it was a server side problem. Here from my host support.

Code: Select all

I've gone ahead and enabled allow_open_furl in your PHP options.
Looking at it your PHP version was set to native on our end not enabling us to use CloudLinux's PHP settings editor.
After testing your site seems to run find on PHP 5.6, and the allow_url_fopen option is set to On within it by default.

Re: Google ReCaptcha error

Posted: Sun Oct 28, 2018 11:08 am
by cahb52
hi, i have the same problem, but in php info shows allow_url_fopen is on, for me google recaptcha works fine, but when i try to install any extension this fails for the same error.
Sorry for my english but i'm a native spanish.