Наследование: extends CampaignMonitor_API
Пример #1
0
 /**
  * Load the form
  *
  * @return	void
  */
 private function loadForm()
 {
     // create form
     $this->frm = new BackendForm('import');
     // fetch the groups
     $this->externalGroups = $this->cm->getListsByClientId();
     // loop the groups
     foreach ($this->externalGroups as &$group) {
         // add subscribers + count to the group stack
         $group['subscribers'] = BackendMailmotorCMHelper::getSubscribers($group['id']);
         $group['subscribers_amount'] = count($group['subscribers']);
         // get the custom fields
         $customFields = $this->cm->getCustomFields($group['id']);
         // skip this if no custom fields were found
         if (!empty($customFields)) {
             // loop the custom fields
             foreach ($customFields as &$field) {
                 // save only field name in a new format
                 $field = $field['name'];
             }
         }
         // add custom fields to the group stack
         $group['custom_fields'] = empty($customFields) ? null : serialize($customFields);
     }
     // parse the groups
     $this->tpl->assign('groups', $this->externalGroups);
 }
 function cm_object()
 {
     $params =& JComponentHelper::getParams('com_joomailermailchimpintegration');
     $subdomain = $params->get('subdomain');
     $domain = $params->get('domain');
     $username = $params->get('username');
     $pw = $params->get('pw');
     $cm = new CampaignMonitor();
     $api = $cm->userGetApiKey('http://' . $subdomain . '.' . $domain, $username, $pw);
     $cm = new CampaignMonitor($api['anyType']);
     return $cm;
 }
 function _unsubscribe($email)
 {
     $result = $this->cm->subscriberUnsubscribe($email);
     if ($result['Result']['Code'] == 0) {
         return true;
     } else {
         trigger_error('Campaign Monitor Error: ' . $result['Result']['Message']);
     }
 }
 function __actionIndex()
 {
     $checked = @array_keys($_POST['items']);
     if (is_array($checked) && !empty($checked)) {
         //Get Campaign Monitor preferences
         $api_key = $this->_Parent->Configuration->get('api_key', 'campaign_monitor');
         $list_id = $this->_Parent->Configuration->get('list_id', 'campaign_monitor');
         //New Campaign Monitor instance
         $cm = new CampaignMonitor($api_key);
         switch ($_POST['with-selected']) {
             case 'unsubscribe':
                 foreach ($checked as $subscriber) {
                     $result = $cm->subscriberUnsubscribe($subscriber, $list_id, false);
                 }
                 redirect($this->_Parent->getCurrentPageURL());
                 break;
         }
     }
 }
Пример #5
0
 /**
  * class constructor
  * @param CampaignMonitor $monitor CampaignMonitor instance
  */
 public function __construct($monitor, $listId)
 {
     $this->monitor = $monitor;
     $this->auth = ['api_key' => $monitor->getApiKey()];
     $this->list = new \CS_REST_Lists($listId, $this->auth);
 }
<?php 
//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
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;
//This is the actual call to the method, passing email address, name.
$result = $cm->subscriberAdd('*****@*****.**', 'Joe Smith');
if ($result['Result']['Code'] == 0) {
    echo 'Success';
} else {
    echo 'Error : ' . $result['Result']['Message'];
}
//Print out the debugging info
//print_r($cm);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$clientid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$title = 'API Newsletter Subscribers';
$unsubscribePage = '';
$confirmOptIn = 'false';
$confirmationSuccessPage = '';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listCreate($clientid, $title, $unsubscribePage, $confirmOptIn, $confirmationSuccessPage);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->clientGetCampaigns($client_id);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$clientid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$campaign_name = 'March newsletter';
$subject = 'March newsletter';
$from_name = 'John Smith';
$from_email = '*****@*****.**';
$reply_email = '*****@*****.**';
$html_content = 'http://www.campaignmonitor.com/uploads/templates/previews/template-1-left-sidebar/index.html';
$text_content = 'http://www.campaignmonitor.com/uploads/templates/previews/template-1-left-sidebar/textversion.txt';
$subscriber_listid = array('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$subscriber_segments = "";
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->campaignCreate($clientid, $campaign_name, $subject, $from_name, $from_email, $reply_email, $html_content, $text_content, $subscriber_listid, "");
echo '<br><br>';
print_r($result);
//Print out the debugging info
//print_r($cm);
Пример #10
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$listid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$title = 'Updated API Created List';
$unsubscribePage = '';
$confirmOptIn = 'false';
$confirmationSuccessPage = '';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listUpdate($listid, $title, $unsubscribePage, $confirmOptIn, $confirmationSuccessPage);
echo '<br><br>';
print_r($result);
Пример #11
0
 /**
  * Updates a client record.
  *
  * @return	mixed
  * @param	array $record		The client record to update.
  */
 private function updateClient($record)
 {
     // get the account settings
     $url = BackendModel::getModuleSetting($this->getModule(), 'cm_url');
     $username = BackendModel::getModuleSetting($this->getModule(), 'cm_username');
     $password = BackendModel::getModuleSetting($this->getModule(), 'cm_password');
     // try and update the client info
     try {
         // fetch complete list of timezones as pairs
         $timezones = BackendMailmotorCMHelper::getTimezonesAsPairs();
         // init CampaignMonitor object
         $cm = new CampaignMonitor($url, $username, $password, 10, $this->clientID);
         // update the client
         $cm->updateClientBasics($record['company_name'], $record['contact_name'], $record['contact_email'], $record['country'], $timezones[$record['timezone']]);
     } catch (Exception $e) {
         // add an error to the email field
         $this->redirect(BackendModel::createURLForAction('settings') . '&error=campaign-monitor-error&var=' . $e->getMessage() . '#tabSettingsClient');
     }
 }
Пример #12
0
}
if (is_object($jsonObj)) {
    $campaignmonitor = Module::getInstanceByName('campaignmonitor');
    $blocknewsletter = Module::getInstanceByName('blocknewsletter');
    foreach ($jsonObj->Events as $event) {
        $emailAddress = $event->EmailAddress;
        $customerByMail = Customer::getCustomersByEmail($emailAddress);
        if ($customerByMail) {
            $customer = new Customer($customerByMail[0]['id_customer']);
            if ($event->Type == 'Deactivate') {
                $customer->newsletter = false;
            }
            if ($event->Type == 'Subscribe' || $event->Type == 'Update') {
                $customer->newsletter = true;
            }
            $customer->save();
        } else {
            $id_shop = null;
            // set shop context for each subscriber
            if (Shop::isFeatureActive()) {
                $id_shop = $campaignmonitor->getCustomFieldValue('ps Shop ID', $event->CustomFields);
                Shop::setContext(Shop::CONTEXT_SHOP, $id_shop);
            }
            // check if subscribed via newsletter module and unsubscribe if true
            $registerStatus = $blocknewsletter->isNewsletterRegistered($emailAddress);
            if ($registerStatus === 1 && $event->Type == 'Deactivate') {
                CampaignMonitor::unregisterFromPsNewsletter($emailAddress, $registerStatus, $id_shop);
            }
        }
    }
}
<?php 
//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
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;
//This is the actual call to the method, passing email address, name and custom fields. Custom fields should be added as an array as shown here with the Interests and Dog fields.
//Multi-option field values are added as an array within this, as demonstrated for the Interests field.
$result = $cm->subscriberAddWithCustomFields('*****@*****.**', 'Joe Smith', array('Interests' => array('Xbox', 'Basketball'), 'Dog' => 'Fido'));
if ($result['Code'] == 0) {
    echo 'Success';
} else {
    echo 'Error : ' . $result['Message'];
}
//Print out the debugging info
//print_r($cm);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$accessLevel = '63';
$username = '******';
$password = '******';
$billingType = 'ClientPaysWithMarkup';
$currency = 'USD';
$deliveryFee = '7';
$costPerRecipient = '3';
$designAndSpamTestFee = '10';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->clientUpdateAccessAndBilling($client_id, $accessLevel, $username, $password, $billingType, $currency, $deliveryFee, $costPerRecipient, $designAndSpamTestFee);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->userGetTimezones();
echo '<br><br>';
print_r($result);
Пример #16
0
 private function create_account($page_name)
 {
     if ($this->account_user->logged_in($this->site_id)) {
         # TODO: consider removing this duplication (of the dashboard)
         $wrapper = new View('public_account/accounts/dashboard');
         $wrapper->page_name = $page_name;
         $wrapper->content = new View('public_account/accounts/dashboard_index');
         $wrapper->content->account_user = $this->account_user->get_user();
         $wrapper->content->page_name = $page_name;
         return $wrapper;
     }
     if ($_POST) {
         $post = new Validation($_POST);
         $post->pre_filter('trim');
         $post->add_rules('email', 'required', 'valid::email');
         $post->add_rules('username', 'required', 'valid::alpha_numeric');
         $post->add_rules('password', 'required', 'matches[password2]', 'valid::alpha_dash');
         if (!$post->validate()) {
             # $errors  = arr::overwrite($_POST, $post->errors('form_error_messages'));
             return self::display_create($page_name, $_POST, $post->errors());
         }
         # Create new user
         $account_user = ORM::factory('account_user');
         if ($account_user->username_exists($_POST['username'], $this->site_id)) {
             return self::display_create($page_name, $_POST, 'username already exists');
         }
         unset($_POST['password2']);
         $account_user->fk_site = $this->site_id;
         # load vars to user table
         foreach ($_POST as $key => $val) {
             $account_user->{$key} = $val;
         }
         # save the user
         if (!$account_user->save()) {
             return self::display_create($page_name, $_POST, 'There was a problem creating account.');
         }
         # Log user in
         if (!$this->account_user->login($account_user, (int) $this->site_id, $_POST['password'])) {
             die('account created but login failed.');
         }
         ## create new campaign monitor instance for plusjade accounts ##
         if (ROOTACCOUNT === $this->site_name) {
             $user = $this->account_user->get_user();
             include Kohana::find_file('vendor', 'CMBase');
             # Create new account.
             $company = $user->username;
             $name = $user->username;
             $email = $user->email;
             $country = 'United States of America';
             $timezone = '(GMT-08:00) Pacific Time (US & Canada)';
             $cm = new CampaignMonitor();
             $result = $cm->clientCreate($company, $name, $email, $country, $timezone);
             if (is_string($result['anyType'])) {
                 $user->cm_id = $result['anyType'];
                 $user->save();
                 /*
                 $accessLevel = '63';
                 $username = '******';
                 $password = '******';
                 $billingType = 'ClientPaysWithMarkup';
                 $currency = 'USD';
                 $deliveryFee = '7';
                 $costPerRecipient = '3';
                 $designAndSpamTestFee = '10';
                 
                 $result = $cm->clientUpdateAccessAndBilling(
                   $result['anyType'],
                   $accessLevel, 
                   $user->username, 
                   $password, 
                   $billingType, 
                   $currency, 
                   $deliveryFee, 
                   $costPerRecipient, 
                   $designAndSpamTestFee
                 );
                 */
             } else {
                 kohana::log('error', "{$result['anyType']['message']} : CM client {$user->username}");
                 #echo kohana::debug($result);
             }
         }
         # return the user dashboard.
         $wrapper = new View('public_account/accounts/dashboard');
         $wrapper->page_name = $page_name;
         $wrapper->content = new View('public_account/accounts/dashboard_index');
         $wrapper->content->account_user = $this->account_user->get_user();
         $wrapper->content->page_name = $page_name;
         return $wrapper;
         # login success
     }
     return self::display_create($page_name);
 }
function sendCampaign($mailSubscribe, $merge_vars = NULL)
{
    if (defined('CM_APIKEY') && defined('CM_LISTID')) {
        $api_key = CM_APIKEY;
        $client_id = null;
        $campaign_id = null;
        $list_id = CM_LISTID;
        $cm = new CampaignMonitor($api_key, $client_id, $campaign_id, $list_id);
        $result = $cm->subscriberAddWithCustomFields($mailSubscribe, getName($mailSubscribe), $merge_vars, null, false);
        if ($result['Code'] == 0) {
            $output = json_encode(array('type' => 'message', 'text' => 'Thank you for your Subscription.'));
            die($output);
        } else {
            $output = json_encode(array('type' => 'error', 'text' => 'Error : ' . $result['Message']));
            die($output);
        }
    }
}
<?php

//Sample using the CMBase.php wrapper to call Subscribers.GetActive from any version of PHP
//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';
$date = '2000-01-01';
// Subscribers added after this date will be returned. Use the format YYYY-MM-DD HH:MM:SS
$cm = new CampaignMonitor($api_key, $client_id, $campaign_id, $list_id);
//Optional statement to include debugging information in the result
//$cm->debug_level = 1;
$result = $cm->subscribersGetActive($date, $list_id);
if ($result['anyType']['Code'] == 0) {
    echo 'Success';
    print_r($result);
} else {
    echo 'Error : ' . $result['anyType']['Message'];
}
//Print out the debugging info
//print_r($cm);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$key = '[CustomFieldKey]';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listDeleteCustomField($list_id, $key);
echo '<br><br>';
print_r($result);
Пример #20
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$listid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listDelete($listid);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$template_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->templateGetDetail($template_id);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->clientGetTemplates($client_id);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$companyName = 'Created From API';
$contactName = 'Joe Smith';
$emailAddress = '*****@*****.**';
$country = 'United States of America';
$timezone = '(GMT-05:00) Eastern Time (US & Canada)';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->clientCreate($companyName, $contactName, $emailAddress, $country, $timezone);
echo '<br><br>';
print_r($result);
Пример #24
0
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$template_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$template_name = 'Updated Template Name';
$html_url = "http://notarealdomain.com/templates/test/index.html";
$zip_url = "http://notarealdomain.com/templates/test/images.zip";
$screenshot_url = "http://notarealdomain.com/templates/test/screenshot.jpg";
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->templateUpdate($template_id, $template_name, $html_url, $zip_url, $screenshot_url);
echo '<br><br>';
print_r($result);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Text field example
$fieldName = 'Nickname';
$dataType = 'Text';
$options = '';
/*
// Below are examples for the other possible field types
// Number field example
$fieldName = 'Age';
$dataType = 'Number';
$options = '';
// Multi-option select one example
$fieldName = 'Sex';
$dataType = 'MultiSelectOne';
$options = 'Male||Female';
// Multi-option select many example
$fieldName = 'Hobby';
$dataType = 'MultiSelectMany';
$options = 'Surfing||Reading||Snowboarding';
*/
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listCreateCustomField($list_id, $fieldName, $dataType, $options);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$list_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listGetCustomFields($list_id);
echo '<br><br>';
print_r($result);
 /**
  * Send a campaign (pass into function the campaign id and send date)
  *
  * @param string $campaignid 
  * @param string $confirmation_email 
  * @param string $send_date 
  * @return void
  * @author Dan Chadwick
  */
 public function send_campaign($campaignid, $confirmation_email, $send_date)
 {
     $cm = new CampaignMonitor($this->apikey);
     // Optional statement to include debugging information in the result
     $cm->debug_level = 0;
     // This is the actual call to the method
     $result = $cm->campaignSend($campaignid, $confirmation_email, $send_date);
     if (isset($result['Campaign'])) {
         return true;
     } else {
         Kohana::log('error', 'Campaign Monitor Error : ' . $result['Result']['Message']);
         return false;
     }
 }
Пример #28
0
         }
         // ERROR SENDING
     } else {
         /*echo json_encode(array(
         			"status" => "error",
         			"type" => $result["name"]
         		));*/
         echo json_encode(array("status" => "error", "type" => "Looks like something went wrong. Please try again later."));
         errorlog("mailchimp", $result["name"]);
     }
 } elseif ($STORE_MODE == "campaignmonitor") {
     $api_key = $CM_API_KEY;
     $list_id = $CM_LIST_ID;
     /*$client_id = null;
     		$campaign_id = null;*/
     $cm = new CampaignMonitor($api_key, null, null, $list_id);
     $result = $cm->subscriberAdd($email, $firstname);
     // SUCCESS SENDING
     if ($result['Result']['Code'] == 0) {
         echo json_encode(array("status" => "success"));
         // ERROR SENDING
     } else {
         /*echo json_encode(array(
         			"status" => "error",
         			"type" => $result['Result']['Message']
         		));*/
         echo json_encode(array("status" => "error", "type" => "Looks like something went wrong. Please try again later."));
         errorlog("campaignmonitor", "Error : " . $result['Result']['Code'] . " : " . $result['Result']['Message']);
     }
 } elseif ($STORE_MODE == "getresponse") {
     $gr = new GetResponse($GR_API_KEY);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$listid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->listGetDetail($listid);
echo '<br><br>';
print_r($result);
<?php

ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'CMBase.php';
//-----------------------------INPUT PARAMS---------------------------------------
$apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
//-------------------------------------------------------------------------------
$cm = new CampaignMonitor($apikey);
//Optional statement to include debugging information in the result
$cm->debug_level = 1;
//This is the actual call to the method
$result = $cm->clientGetDetail($client_id);
echo '<br><br>';
print_r($result);