HEX
Server: Apache/2.4.41
System: Linux mainweb 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: nationalmedicaregrp (1119)
PHP: 8.3.7
Disabled: exec,passthru,shell_exec,system,popen,proc_open,pcntl_exec
Upload Files
File: /home/searchmyhealthplan/backup/bu/php/subscribe-cm.php
<?php

require_once 'campaign-monitor/csrest_subscribers.php';


$apiKey = ''; // Your Campaign Monitor API Key
$listId = ''; // Your Campaign Monitor List ID


if( isset( $_GET['list'] ) AND $_GET['list'] != '' ) {
	$listId = $_GET['list'];
}

$email = $_POST['subscribe-form-email'];

if( isset( $email ) AND $email != '' ) {

	$auth = array('api_key' => $apiKey);

	$wrap = new CS_REST_Subscribers( $listId, $auth);

	$result = $wrap->add(array(
		'EmailAddress' => $email,
		'Resubscribe' => true
	));

	if($result->was_successful()) {
		echo '{ "alert": "success", "message": "You have been <strong>successfully</strong> subscribed to our Email List." }';
	} else {
		echo '{ "alert": "error", "message": "Failed with code ' . $result->http_status_code . "\n<br /><pre>";
		var_dump($result->response);
		echo '</pre>" }';
	}

}