Forums

ReCaptcha (noCaptcha) with php 7

Gatsman 13 May, 2017
I just upgraded my php version to 7.1.4 and i can't pass the noCaptcha check (in forms that where working with php 5.6).
In the same website i can pass noCaptcha check correctly outside Chronoforms (Default Registration Form).
Gatsman 13 May, 2017
ERROR LOG

[13-May-2017 07:12:13 UTC] PHP Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/concep/public_html/administrator/components/com_chronoforms5/chronoforms/actions/check_nocaptcha/check_nocaptcha.php on line 29

[13-May-2017 07:12:13 UTC] PHP Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=6LedYRMTAAAAAN7XizvBv7hMEhRXqhZs1vKGcva3&response=03AIezHSaabwQLjzcEFR4tWy1uZODs7mtsns9EnA_Mx3AxAuTJo1PGMVl6XvIgw2WIx66wZN-pkv4L6poEbC85bzoCRgZGWq0qZbn7pNIW0-a3nuAigDDccq0tDHjkQPnDsXktv1TMk7Sq-IJsfc1VezNcE5fiY8eg4SPlmD8tbxwEEMaI3LIGJIop9tT0U5Ot-uot51yA9ERXwSC4Q5IIRD71logYcsHpygHjhp6m6xRnPYoegGAKcBzZFoMGWTqCJTpglnyBEzXxPsC9fUwB8CaxI0u61ao_1zDNZj1ldfjZoow12qdE8t_154T8CrDWFqn-M9rz-u9F): failed to open stream: no suitable wrapper could be found in /home/concep/public_html/administrator/components/com_chronoforms5/chronoforms/actions/check_nocaptcha/check_nocaptcha.php on line 29

[13-May-2017 07:12:13 UTC] PHP Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify?secret=6LedYRMTAAAAAN7XizvBv7hMEhRXqhZs1vKGcva3&response=03AIezHSaabwQLjzcEFR4tWy1uZODs7mtsns9EnA_Mx3AxAuTJo1PGMVl6XvIgw2WIx66wZN-pkv4L6poEbC85bzoCRgZGWq0qZbn7pNIW0-a3nuAigDDccq0tDHjkQPnDsXktv1TMk7Sq-IJsfc1VezNcE5fiY8eg4SPlmD8tbxwEEMaI3LIGJIop9tT0U5Ot-uot51yA9ERXwSC4Q5IIRD71logYcsHpygHjhp6m6xRnPYoegGAKcBzZFoMGWTqCJTpglnyBEzXxPsC9fUwB8CaxI0u61ao_1zDNZj1ldfjZoow12qdE8t_154T8CrDWFqn-M9rz-u9F): failed to open stream: no suitable wrapper could be found in /home/concep/public_html/administrator/components/com_chronoforms5/chronoforms/actions/check_nocaptcha/check_nocaptcha.php on line 29
GreyHead 13 May, 2017
Answer
Hi Gatsman,

Please try enabling file_get_contents in the PHP settings; if you aren't allowed to do that then I have a version of the action that uses cURL instead but that hasn't been tested with PHP 7.1

Bob
Gatsman 13 May, 2017
Hello Bob,
That did the trick
Thank you
cirymarr 14 May, 2017
Hi

I'm not allowed to make that PHP setting.

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

Could you help me please? The link to the Chrono 6 form is http://www.dev.cargolift.ie/index.php/single-contact-3
This topic is locked and no more replies can be posted.