campaignmonitor/createsend-php

Curl Exception

Closed this issue · 7 comments

Hi. I looped through an array of 13 elements sending 13 different emails. Below is an example of the last two elements and the foreach() loop. Looks like I got a curl error on the last iteration of the loop.
*Fatal error:* Uncaught exception 'CurlException' with message 'Error making request with curl_error: Operation timed out after 10000 milliseconds with 0 bytes received' in /domain.com/php/createsend-php-master/class/transport.php:165 Stack trace: #0 /domain.com/php/createsend-php-master/class/base_classes.php(289): CS_REST_CurlTransport->make_call(Array) #1 /domain.com/php/createsend-php-master/class/base_classes.php(224): CS_REST_Wrapper_Base->_call(Array, 'POST', 'https://api.cre...', Array) #2 /domain.com/php/createsend-php-master/csrest_transactional_smartemail.php(144): CS_REST_Wrapper_Base->post_request('https://api.cre...', Array) #3 /domain.com/roster/preshow-email.php(55): CS_REST_Transactional_SmartEmail->send(Array) #4 {main} thrown in /domain.com/php/createsend-php-master/class/transport.php on line 165

            Array
            (
                [11] => Array
                    (
                        [email] => brett@email.com
                        [name] => Brett Loudermilk
                    )

                [12] => Array
                    (
                        [email] => david@email.com
                        [name] => David Deeble
                    )

            )


            foreach($a as $act){
                # Create a new mailer and define your message
                $recipient =  "{$act['name']} <{$act['email']}>";
                print $recipient;
                $wrap = new CS_REST_Transactional_SmartEmail($smart_email_id, $auth);
                $message = array(
                    "To" => $recipient,
                    "Data" => array(
                        'SHOWDATE' => $db,
                        'SHOWORDER' => 'http://boobietrapshow.com/',
                        'PERFORMERPAGE' => 'http://boobietrapshow.com/',
                    ),
                );
                # Send the message and save the response
                $result = $wrap->send($message);
                echo "<br/><pre>" , print_r($result), "</pre>";
            }

We are facing same issue on today 06 march 2018 for 30 seconds timeout.

[Tue Mar 06 16:32:24 2018] [error] [client 210.120.210.130] PHP Fatal error: Uncaught exception 'CurlException' with message 'Error making request with curl_error: Operation timed out after 30001 milliseconds with 0 bytes received' in /var/www/vhosts/website/httpdocs/wp-content/themes/project/campaign/class/transport.php:174, referer:

We are hitting with only one email. API does not respond within 30 seconds.
Please can anyone look into this issue.

I am also facing this issue

Any update please?

2017-10-20T14:49:06+00:00 CRITICAL Uncaught exception 'CurlException' with message 'Error making request with curl_error: Operation timed out after 10001 milliseconds with 0 bytes received' in /home/zzz/public_html/wpnew/wp-content/themes/zzz/assets/zzz/class/transport.php:174
Stack trace:
0 /home/zzz/public_html/wpnew/wp-content/themes/zzz/assets/zzz/class/base_classes.php(291): CS_REST_CurlTransport->make_call(Array)
1 /home/zzz/public_html/wpnew/wp-content/themes/zzz/assets/zzz/class/base_classes.php(234): CS_REST_Wrapper_Base->_call(Array, 'GET', 'https://api.cre...')
2 /home/zzz/public_html/wpnew/wp-content/themes/zzz/assets/zzz/csrest_subscribers.php(181): CS_REST_Wrapper_Base->get_request('https://api.cre...')
3 /home/zzz/public_html/wpnew/wp-content/themes/zzz/assets/zzz/cm-basic-subscriber-update.php(52): CS_REST_Subscribers->get('')

@scotnery did you resolve it - what was the issue?

jgerk commented

Got the same error in the transport file. Below is the error message I got from logs. Anyone solve this?

In transport.php line 174:

Error making request with curl_error: Operation timed out after 10000 milli
seconds with 0 bytes received

Increased default time from 10 -> 20 sec in this commit: e4e0c4b. Larger API calls may take longer than the previous default of 10 sec. Also added instructions on readme on how to increase local timeout parameters.

This issue happens for me as well, and it happends almost immediately, no time for timeouts to affect it. Any ideas?

Same again. Sending a testing mail with template reference:

Error making request with curl_error: Operation timed out after 20000 milliseconds with 0 bytes received

I think that timeout should be configurable from class:

$api = new CS_REST_Campaigns($id, $auth);
$api->setTimeout(30);