Created
June 7, 2012 11:58
-
-
Save colinramsay/2888419 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 = '9fd115edeef04b86080a2838baa28a89'; | |
$client_id = null; | |
$campaign_id = null; | |
$list_id = '95b3a886fca5e7572963bf2c69d4ad1f'; | |
$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($_POST["email"], $_POST["email"]); | |
$is_successful = $result['Result']['Code'] == 0 ? true : false; | |
$result_message = $result['Result']['Message']; | |
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { | |
// ajax | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment