• Resolved pfazziniteknonet

    (@pfazziniteknonet)


    Good morning,

    I am trying to implement hCaptcha on my site.I installed this plugin, when I try to configure it, after entering the Site Key and Secret Key, I resolve the Captcha that is proposed to me and finally I click on the “Check Site Config” button.

    However, I get this error back, “Site configuration error: Cannot communicate with hCaptcha server.” In addition, the save button is disabled.What am I doing wrong?

    Regards and thanks in advance for the help

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    Hello,

    Could you provide the System Info?

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    Good morning, everyone,
    I hope they are enough to solve the problem

    -- hCaptcha Info --
    
    Version: 3.9.0
    Site key: Not set
    Secret key: Not set
    Theme:
    Size:
    Language: Auto-detect
    Mode: live
    Custom Themes: Off
    Config Params: Not set
    Turn Off When Logged In: Off
    Disable reCAPTCHA Compatibility: Off
    Whitelisted IPs: Not set
    Login attempts before hCaptcha:
    Failed login attempts interval, min: 15
    Delay showing hCaptcha, ms: -100
    Migrations:
    2.0.0: 09/02/2024 08:44
    3.6.0: 09/02/2024 08:44 --- Active plugins and themes --- Contact Form 7:
    Form: On
    Elementor Pro:
    Form: On
    WP Core:
    Comment Form: On
    Login Form: Off
    Lost Password Form: Off
    Post/Page Password Form: Off
    Register Form: Off -- WordPress Configuration -- Version: 5.8.6
    Language: it_IT
    User Language: it_IT -- Webserver Configuration -- PHP Version: 7.3.27
    MySQL Version: 5.7.33
    Webserver Info: Apache
    Plugin Contributor kaggdesign

    (@kaggdesign)

    Thank you for providing the info. But you have cut it in some parts, so I cannot see — PHP Extensions — section, which is important.

    Problem looks like you do not have curl extension enabled.

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    Hi, no the curl extension is enabled:

    — PHP Extensions —

    cURL: Supported
    fsockopen: Supported
    SOAP Client: Installed
    Suhosin: Not Installed

    Plugin Contributor kaggdesign

    (@kaggdesign)

    It may be that curl cannot create an https connection. On Site Health admin page you should have this in Passed Tests: https://i.imgur.com/NqIVmsf.png

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    I checked and wordpress tells me that that check has been passed

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    Hi, do you have any updates on this issue? Can I provide you with more information to find what is wrong? Analyzing the code, I noticed that the post request for configuration check has no body. Is this normal?

    https://docs.hcaptcha.com/#verify-the-user-response-server-side
    It says here that dve must be provided the “site secret”.

    But reading the code I find this:
    $settings = hcaptcha() -> settings();
    $params = [
    ‘host’ => (string) wp_parse_url(site_url(), PHP_URL_HOST),
    ‘sitekey’ => $settings -> get_site_key(),
    ‘sc’ => 1,
    ‘swa’ => 1,
    ‘spst’ => 0,
    ];
    $url = add_query_arg($params, hcaptcha() -> get_check_site_config_url());

    $raw_response = wp_remote_post($url);

    $raw_body = wp_remote_retrieve_body($raw_response);

    if (empty($raw_body)) {
    $this -> send_check_config_error(__(‘Cannot communicate with hCaptcha server.’, ‘hcaptcha-for-forms-and-more’));
    }

    I wonder if the problem is not here

    Plugin Contributor kaggdesign

    (@kaggdesign)

    Can you make var_dump or error_log of $raw_response? I want to see the answer from the server.

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    Hi, thanks for the quick response.
    I have done var_dump of raw_response and the content is this:

    object(WP_Error)#13947 (3) { [“errors”]=> array(1) { [“http_request_failed”]=> array(1) { [0]=> string(58) “cURL error 28: Resolving timed out after 5514 milliseconds” } } [“error_data”]=> array(0) { } [“additional_data”:protected]=> array(0) { } }

    So since a resolution problem is indicated I tried to dump also url:

    https://api.hcaptcha.com/checksiteconfig?host=www.teknonet.it&sitekey=*********&sc=1&swa=1&spst=0

    Of course, I have taken care to obscure my sitekey

    Plugin Contributor kaggdesign

    (@kaggdesign)

    It is definitely your site problem (cURL error 28: Resolving timed out after 5514 milliseconds). The curl cannot communicate and fails by timeout. It may happen due to a wrong SSL certificate or some other reason.

    Please read this article.

    Thread Starter pfazziniteknonet

    (@pfazziniteknonet)

    I have solved the problem, I write my solution for someone who has the same problem as me:
    I solved by simply changing the server DNS from google’s to my company’s internal DNS.

    Plugin Contributor kaggdesign

    (@kaggdesign)

    Thank you for reporting.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Configuration error: Cannot communicate with hCaptcha server.’ is closed to new replies.