PHP Wrapper for API v3 throwing odd errors

New API looks great, however, I can't seem to get the new PHP Wrapper working.

Out of the box, if I add my API key and test out samples/get_clients.php, I get the following error:

Fatal error: Class 'CS_REST_Log' not found in C:\xampp\htdocs\folder\class\base_classes.php on line 122

After a good bit of troubleshooting it seems that the problem is being caused by the log.php filename (?!).  If I change the log.php filename to log2.php and modify the base_classes.php to pull in log2.php instead of log.php, the first error is resolved and I am presented this second error:

Fatal error: Class 'CS_REST_Log' not found in C:\xampp\htdocs\folder\class\base_classes.php on line 122

I haven't tried to solve this second error yet, but remain perplexed by the first, especially because it seems that others are using v3 wrapper without this happening.

Any ideas?

lehongduc87, 5 years ago

Hi! I had a same problem. Can CM have ideas?

tobyb tobyb, 5 years ago

Hey guys,

You probably have another file called log.php in your require path which has already been included. We've just pushed a new version of the wrapper which should fix this issue for you.

As usual you can get the wrapper from:

bparizek, 5 years ago

Thanks tobyb.  All seems to be working fine on my mac, but I'm still getting errors on my work computer which runs Windows and XAMPP.

The error I'm getting now when I run samples/list/get.php (and add the proper keys) is:

Call to a member function make_call() on a non-object in C:\xampp\htdocs\...\class\base_classes.php on line 220
tobyb tobyb, 5 years ago


From that error message alone I would say that the wrapper was not able to create an available transport scheme. Is the cURL extension correctly installed on the windows box (a curl section will show up in phpinfo() if it is)?

If you get the wrapper to log it's activity and reply here with it we can look into it further.
For the list/get sample you'd change

$wrap = new CS_REST_Lists('List ID', 'Your API Key');


$wrap = new CS_REST_Lists('List ID', 'Your API Key', 'https', CS_REST_LOG_VERBOSE);
bparizek, 5 years ago

You got it.  I installed Curl and we're up and running.  Thanks for the help!

vperu_forum, 5 years ago

I got this far through this list of issues and cURL is now installed and working fine per;

however, I have now crashed out with the following:

19:12:56 - 250: Error making request with curl_error: 60

Fatal Error (256): Error making request with curl_error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [APP\vendors\createsend\class\transport.php, line 91]
Code | Context

        if(!$response && $response !== '') {

            $this->_log->log_message('Error making request with curl_error: '.curl_errno($ch), CS_REST_LOG_ERROR);

            trigger_error('Error making request with curl_error: '.curl_error($ch), E_USER_ERROR);

$call_options    =    array(
    "credentials" => "2cf9017306dd82846ca7482aa93419c6:nopass",
    "userAgent" => "CS_REST_Wrapper v1.0.4 PHPv5.3.2 over cURL with native",
    "contentType" => "application/json; charset=utf-8",
    "deserialise" => true,
    "host" => "",
    "protocol" => "https",
    "route" => "",
    "method" => "POST",
    "data" => "{"EmailAddress":"","Name":"Bill Baily","Resubscribe":true}"
$ch    =    resource
$response    =    false
$this    =    CS_REST_CurlTransport
CS_REST_CurlTransport::$_log = CS_REST_Log object

CS_REST_CurlTransport::make_call() - APP\vendors\createsend\class\transport.php, line 91
CS_REST_Wrapper_Base::_call() - APP\vendors\createsend\class\base_classes.php, line 220
CS_REST_Wrapper_Base::post_request() - APP\vendors\createsend\class\base_classes.php, line 168
CS_REST_Subscribers::add() - APP\vendors\createsend\csrest_subscribers.php, line 75
VolunteersController::add() - APP\controllers\volunteers_controller.php, line 23
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83

Any thoughts? Thanks for the help ...

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free