Hi, I enabled Google Re-Captcha but it does not seem to be working.
This is the error I get on the Contact Us page when I click the submit button.
"Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/spectretp/public_html/catalog/controller/captcha/google_captcha.php on line 26Warning: file_get_contents(https://www.google.com/recaptcha/api/si ... 147.84.198): failed to open stream: no suitable wrapper could be found in /home/spectretp/public_html/catalog/controller/captcha/google_captcha.php on line 26 "
Also, if I enable re-captcha on reviews, I cannot submit reviews.
Any ideas?
This is the error I get on the Contact Us page when I click the submit button.
"Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/spectretp/public_html/catalog/controller/captcha/google_captcha.php on line 26Warning: file_get_contents(https://www.google.com/recaptcha/api/si ... 147.84.198): failed to open stream: no suitable wrapper could be found in /home/spectretp/public_html/catalog/controller/captcha/google_captcha.php on line 26 "
Also, if I enable re-captcha on reviews, I cannot submit reviews.
Any ideas?
I get a similar problem.
The issue started recently... All was working about 2 months ago.. Server has not made any changes to configuration.
Edit:
The generated URL for ReCaptcha gets a successful response from Google... Looks like the file_get_contents needs attention.
Code: Select all
Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in D:\Wwwroot\artofmusic\trgovina\opencart-2.1.0.1\catalog\controller\captcha\google_captcha.php on line 30
Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify...): failed to open stream: Invalid argument in D:\Wwwroot\artofmusic\trgovina\opencart-2.1.0.1\catalog\controller\captcha\google_captcha.php on line 30
Edit:
The generated URL for ReCaptcha gets a successful response from Google... Looks like the file_get_contents needs attention.
After looking at some other topics.
I think the problem is maybe due to my server. I kn ow it's pretty strict and they don't allow much.
If this is the case and i cannot change things server side. Is there a work around to make recaptcha work?
Anyone any ideas?
Thanks in advance!
I think the problem is maybe due to my server. I kn ow it's pretty strict and they don't allow much.
If this is the case and i cannot change things server side. Is there a work around to make recaptcha work?
Anyone any ideas?
Thanks in advance!
Im in 2.0.2.0 But I was able to get mine working with a dirty work around by changing this code
To this code
This is in my controller>information>contact.php Not sure why it stoped working all of a sudden but this saved my @$$
Code: Select all
if ($this->config->get('config_google_captcha_status')) {
if (isset($this->request->post['g-recaptcha-response'])) {
$recaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('config_google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']);
$recaptcha = json_decode($recaptcha, true);
if (!$recaptcha['success']) {
$this->error['captcha'] = $this->language->get('error_captcha');
}
}
}
To this code
Code: Select all
if ($this->config->get('config_google_captcha_status')) {
if (isset($this->request->post['g-recaptcha-response'])) {
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('config_google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR'];
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
echo "\n<br />";
$contents = '';
} else {
curl_close($ch);
}
if (!is_string($contents) || !strlen($contents)) {
echo "Failed to get contents.";
$contents = '';
}
$contents = json_decode($contents, true);
if (!$contents['success']) {
$this->error['captcha'] = $this->language->get('error_captcha');
}
}
}
This is in my controller>information>contact.php Not sure why it stoped working all of a sudden but this saved my @$$
A slightly different version also works in 3.0.3.2:
It's such a shame it was never fixed in a release 
Code: Select all
// Use curl instead https://forum.opencart.com/viewtopic.php?t=161727
$url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR'];
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$contents = curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
echo "\n<br />";
$contents = '';
} else {
curl_close($ch);
}
if (!is_string($contents) || !strlen($contents)) {
echo "Failed to get contents.";
$contents = '';
}
$contents = json_decode($contents, true);
if (!$contents['success']) {
$this->session->data['gcapcha'] = true;
} else {
return $this->language->get('error_captcha');
}

What code does this replace?crosland wrote: ↑Sat Dec 07, 2019 12:51 amA slightly different version also works in 3.0.3.2:
It's such a shame it was never fixed in a releaseCode: Select all
// Use curl instead https://forum.opencart.com/viewtopic.php?t=161727 $url = 'https://www.google.com/recaptcha/api/siteverify?secret=' . urlencode($this->config->get('google_captcha_secret')) . '&response=' . $this->request->post['g-recaptcha-response'] . '&remoteip=' . $this->request->server['REMOTE_ADDR']; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); $contents = curl_exec($ch); if (curl_errno($ch)) { echo curl_error($ch); echo "\n<br />"; $contents = ''; } else { curl_close($ch); } if (!is_string($contents) || !strlen($contents)) { echo "Failed to get contents."; $contents = ''; } $contents = json_decode($contents, true); if (!$contents['success']) { $this->session->data['gcapcha'] = true; } else { return $this->language->get('error_captcha'); }
![]()
Just use our invisible one instead as it's miles better anyway: https://www.opencart.com/index.php?rout ... er=antropy
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
This forum thread is several years old! Anyway, we recommend using the SpamBot Buster, no need for cumbersome captchas, no need for calling 3rd party external URLs.
Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig
Who is online
Users browsing this forum: No registered users and 27 guests