Okay
  Public Ticket #3069833
WP Datatables cURL Error 28 most of my tables after update!!!
Closed

Comments

  •  1
    Mee started the conversation

    Hi, I am having massive issues with my tables at after updating the plugin. How can I roll back to the previous release? 

    It seems to be an issue with all my tables that are set to fill the width of the screen. As soon as I change them or look at the old ones there is a cURL 28 error.

  •  2,572
    Aleksandar replied

    Hello Mee, thank you for reaching out to us.

    1. If you're using the API method:

    This error is returned by the function wp_remote_get which uses cURL in the background. The client's server doesn't have time to manage the data from Google's API in 5 seconds (which is the default setting in WordPress).

    That limit can be increased using a hook https://wordpress.stackexchange.com/questions/341357/wp-remote-get-curl-error-28-only-on-same-domain. Instead of "15" set it to "100", just in case.

    If you get this error because of the WordPress hook extend_http_request_timeout, you need to remove it from your functions.php file and then checkout solutions for the first initial error for curl error 28 - Operation timed out ...

    https://www.wpbeginner.com/wp-tutorials/how-to-fix-curl-error-28-connection-timed-out-after-x-milliseconds/

    2. If you're using the old method (without Google's API credentials) the timeout limit is set to 25 in file wp-content/plugins/wpdatatables/source/class.wdttools.php on line 198.

    This can be overwritten with the hook wpdatatables_curl_get_data. For example:

    function filterCURLOptions($data, $ch, $url){
       $new_ch = curl_init();
       $timeout = 1000;
       $agent = 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0';
            curl_setopt($new_ch, CURLOPT_URL, $url);
            curl_setopt($new_ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($new_ch, CURLOPT_CONNECTTIMEOUT, $timeout);
            curl_setopt($new_ch, CURLOPT_USERAGENT, $agent);
            curl_setopt($new_ch, CURLOPT_REFERER, site_url());
            curl_setopt($new_ch, CURLOPT_FOLLOWLOCATION, true);
            $data = curl_exec($new_ch);
                if (curl_error($new_ch)) {
                    $error = curl_error($new_ch);
                    curl_close($new_ch);
                    throw new Exception($error);
                }
                if (strpos($data, '<title>Moved Temporarily</title>')) {
                    throw new Exception(__('wpDataTables was unable to read your Google Spreadsheet, probably it is not published correctly. <br> You can publish it by going to <b>File -> Publish to the web</b> ', 'wpdatatables'));
                }
                $info = curl_getinfo($new_ch);
                curl_close($new_ch);
                if ($info['http_code'] === 404) {
                    return NULL;
                }
       
        return $data;
    }
    add_filter('wpdatatables_curl_get_data','filterCURLOptions', 10, 3);
    

    This needs to go to the functions.php file of your theme or the child theme (depending on what you're using).

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables