Intergrated Campaign Monitor API

I'm trying to integrate the CM API into a PHP CMS that some else has built. Could some give me direction on how to start...? This is my first time implementing an API. I read all the documentation (I think..or the ones that I could find) to help me start?

Leigh

Leigh, 7 years ago

...Do you used Campaign.Create..php as an include in your layout?

<?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 = 'john@smith.com';
$reply_email = 'john@smith.com';
$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);

?>

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
1-888-533-8098