Buy Now
Sign in

Chronoforms 6 curl workaround required for Google ReCaptcha/NoCaptcha

cirymarr , May 16 at 16:28
c
cirymarr

Hi

I'm using Chronoforms 6 (for the first time, on a development site), having used Chrono5 on nearly 100 sites up until now.

I have to have Google ReCaptcha/NoCaptcha operational, however, it is not working.

My shared hosting does not allow/cater for the PHP enabling of file_get_contents, so I need another solution.

I had a workaround to get Google NoCaptcha to work on Chronoform5 in the check_nocaptcha.php file as follows:

// Original code $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$config->get('secret_key')."&response=".$form->data('g-recaptcha-response'));

Replaced with:

$ch = curl_init("https://www.google.com/recaptcha/api/siteverify?secret=".$config->get('secret_key')."&response=".$form->data('g-recaptcha-response'));
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);

However, I can't find the corresponding file check_nocaptcha.php in Chronoforms 6

I set error reporting to Maximum and get the following response after submitting the form:

Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /var/www/vhosts/86/876293/webspace/httpdocs/dev.cargolift.ie/libraries/cegcore2/admin/extensions/chronofc/functions/google_nocaptcha/google_nocaptcha_output.php on line 9

Could you help me please? The link to my Chrono 6 form is http://www.dev.cargolift.ie/index.php/single-contact-3

I know very little about PHP, and tried to implement my Chrono 5 change in the google_nocaptcha_output.php without success.

Thanks in advance

admin

Hi cirymarr,

Please send me a message using the "contact us" page to get a patch file with this update.

Best regards,
Max

Max
If your main question got answered then please mark the answer using the button!