API integration error

Question asked by James Sarjeant 7 months ago


I've created some code using the PHP API examples you have on GitHub. I got the code working successfully on a test server but pushing to the live environment I'm suddenly getting an error saying SoapClient class could not be found.

I've uploaded all the code so that is all fine as far as I can see. I created a wrapper class for the various bits needed and that looks as follows:

class clearbooks extends dbdata{

private $client;

public function __construct()
    global $arrConfig;


    $clearbooksUrl = $arrConfig['clearBooksURL'];

    $this->client = new SoapClient($clearbooksUrl.'api/accounting/wsdl/');

        new SoapHeader($clearbooksUrl . 'api/accounting/soap/',
            'authenticate', array('apiKey' => $arrConfig['clearBooksAPIKey'])),

The $arrConfig array exists and is populated. There is also an autoload in the config file which works fine on the test site, and for everything else, and again hasn't changed.

I have no idea where the issue lies, so does anyone else have this problem or a solution to it? I can provide more code details if need be.

Thanks in advance.

3 Replies

Hi James,

You would need to install the php-soap extension.

All the best,


Hi Mohamed,

Thank you for that, it worked perfectly. I just had to chase the hosting company to install the thing I asked them to install before!

All the best

Hi James,

You're more than welcome!

All the best,


Reply to this question

Attach images by dragging and dropping or upload

Your comments will be public and can be answered by anyone in the Clear Books community.

Find out what we do and who we are