php and API


sorry for my english, I am french

I try to use the API but I have a problem

I hope that you can help me

This is my test :

and I use this code

    //Sample using the CMBase.php wrapper to call Subscriber.AddWithCustomFields from any version of PHP
    //Relative path to CMBase.php. This example assumes the file is in the same folder
    //Your API Key. Go to to see where to find this and other required keys
    $api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
    $client_id = null;
    $campaign_id = null;
    $list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
    $cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );
    //Optional statement to include debugging information in the result
    //$cm->debug_level = 1;
    //This is the actual call to the method, passing email address, name.
    $result = $cm->subscriberAdd('', 'Joe Smith');

    if($result['Result']['Code'] == 0)
        echo 'Success';
        echo 'Error : ' . $result['Result']['Message'];
    //Print out the debugging info

It's very long to ad a Subscriber in my list and I don't know why...

I use php 4

Thank you


Stig Stig, 6 years ago

Hi Michaël,

Sorry to hear you're having troubles. I see we've replied to this via email, so I just wanted to post here in case you hadn't received our answer.

When one of our developers tested the form at, the API logs show that the command took less than 100 milliseconds to execute.

So the issue seems to be with your server or your connection. Could you check with your host if they're having any problems, or if they can help find out why the form is taking so long to submit?


The Campaign Monitor Blog – HTML email smarts to go with your good looks.

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free