Reply To: recaptcha v3

#10034551
Support
Keymaster

Hello,

That error means a problem with external request from your server to google recaptcha server.

On this case we need debug the return of response. For it please change the part of code that check the response with this new below:

(php/contact-form-recaptcha-v3.php):

....
........
.....
.............
if( ini_get('allow_url_fopen') ) {
	//reCAPTCHA - Using file_get_contents()
	$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
	$responseData = json_decode($verifyResponse);

	// ------------------ DEBUG CODE ------------------
	// ------------------------------------------------
	$arrResult = array ('response'=>'error','errorMessage'=>'Method: FOPEN. Response: ' . $responseData);
	echo json_encode($arrResult);
	die();
	// ------------------ END DEBUG CODE ------------------
	// ----------------------------------------------------

} else if( function_exists('curl_version') ) {
	// reCAPTCHA - Using CURL
	$fields = array(
        'secret'    =>  $secret,
        'response'  =>  $_POST['g-recaptcha-response'],
        'remoteip'  =>  $_SERVER['REMOTE_ADDR']
    );

    $verifyResponse = curl_init("https://www.google.com/recaptcha/api/siteverify");
    curl_setopt($verifyResponse, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($verifyResponse, CURLOPT_TIMEOUT, 15);
    curl_setopt($verifyResponse, CURLOPT_POSTFIELDS, http_build_query($fields));
    $responseData = json_decode(curl_exec($verifyResponse));
    curl_close($verifyResponse);

    // ------------------ DEBUG CODE ------------------
	// ------------------------------------------------
    $arrResult = array ('response'=>'error','errorMessage'=>'Method: CURL. Response: ' . $responseData);
	echo json_encode($arrResult);
	die();
	// ------------------ END DEBUG CODE ------------------
	// ----------------------------------------------------

} else {
	$arrResult = array ('response'=>'error','errorMessage'=>'You need CURL or file_get_contents() activated in your server. Please contact your host to activate.');
	echo json_encode($arrResult);
	die();
}
......
..........
......
..........

This way a new error message will appear when try to send the contact form. Please share with us this new error message.

Kind Regards,

Rodrigo.


If you are satisfied with Porto HTML and our support, please leave your comment and rating on ThemeForest downloads page. That helps us a lot: https://themeforest.net/downloads