I thought I would throw up a php example on how to get the size of a list.
<?php //Sample using the CMBase.php wrapper //Relative path to CMBase.php. This example assumes the file is in the same folder require_once('CMBase.php'); //Your API Key. Go to http://www.campaignmonitor.com/api/required/ 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; //Subscribers added after the Date value specified will be returned. Must be in the format YYYY-MM-DD HH:MM:SS. $Date = '2009-05-01 01:01:00'; //This is the actual call to the method $result = $cm->subscribersGetActive($Date); if($result['Result']['Code'] == 0) echo 'Success'; else echo 'Error : ' . $result['Result']['Message']; //check the size of the array $list_size = sizeof($result['anyType']['Subscriber']); echo '<p>Size of list: '.$list_size.'</p>'; //Print out the debugging info //print_r($cm); ?>
I hope that I've done this right - It works fine for me. It's really basic but handy when calculating the cost of a campaign.
Please let me know if there is anything wrong with this and I'll update it accordingly.
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