Use of undefined constant CURLOPT_CONNECTTIMEOUT_MS

I use PHP 5.3.19 (cli) (built: Dec  2 2012 11:25:34)
which has Curl version 7.15.5

When I use the latest version of the API:

Notice Error: Use of undefined constant CURLOPT_CONNECTTIMEOUT_MS - assumed 'CURLOPT_CONNECTTIMEOUT_MS' in [CampaignMonitor/class/transport.php, line 92]

Warning Error: curl_setopt() expects parameter 2 to be long, string given in [CampaignMonitor/class/transport.php, line 92]

Notice Error: Use of undefined constant CURLOPT_TIMEOUT_MS - assumed 'CURLOPT_TIMEOUT_MS' in [CampaignMonitor/class/transport.php, line 93]

Warning Error: curl_setopt() expects parameter 2 to be long, string given in [CampaignMonitor/class/transport.php, line 93]

jamesd jamesd, 1 year ago

Hey, it seems that this problem could be related to the way some constants are defined by certain versions of PHP.

Could you please let me know if this StackOverflow answer fixes the issue for you?

If it does, I could make a modification to the wrapper to ensure that this problem doesn't happen again.

Thanks for the feedback.

jamesd jamesd, 1 year ago

A little more reading would suggest that we could potentially just be using the CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT constants instead.

Could you verify whether or not using the following code instead fixes the issue in your environment:

curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, CS_REST_SOCKET_TIMEOUT);
curl_setopt($ch, CURLOPT_TIMEOUT, CS_REST_CALL_TIMEOUT);

I've just committed a fix for this, contained within a pull request. If you can verify that this fixes your problem, I'll merge the pull request and release a new patch version of createsend-php (2.5.1).

Thanks.

gemal, 1 year ago

yes it fixes it

jamesd jamesd, 1 year ago

Cool, I've just released version 2.5.1 of createsend-php with that fix. Glad to help.

Sign up for free.
Then send campaigns for as little as $9p/m

Create an account