More information...
I can run this:
require_once './inc/MCAPI.class.php'; //need when in funcitons.php
require_once './inc/config.inc.php'; //contains apikey //need when
in funcitons.php
$api = new MCAPI($apikey);
$retval = $api->campaignStats('xxxxxxxxxx');
if ($api->errorCode){
echo "Unable to Load Campaign Stats!";
echo "\n\tCode=".$api->errorCode;
echo "\n\tMsg=".$api->errorMessage."\n";
} else {
echo "Stats for campaign<br>";
foreach($retval as $k=>$v){
echo " ".$k." => ".$v."<br>";
}
}
echo "<br><br>";
...without error, while at the same time I get the error runing this:
require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey
$api = new MCAPI($apikey);
$listId = 'xxxxxxxxxx'; //letter list on MailChimp
$my_email = 'xx...@xxx.xxx';
/**
Note that if you are not passing merge_vars, you will still need to
pass a "blank" array. That should be either:
$merge_vars = array('');
- or -
$merge_vars = '';
Specifically, this will fail:
$merge_vars = array();
Or pass the proper data as below...
*/
$merge_vars = array('FNAME'=>'xxx', 'LNAME'=>'xxx',
'INTERESTS'=>'');
// By default this sends a confirmation email - you will not see new
members
// until the link contained in it is clicked!
$retval = $api->listSubscribe( $listId, $my_email, $merge_vars );
if ($api->errorCode){
echo "Unable to load listSubscribe()!\n";
echo "\tCode=".$api->errorCode."\n";
echo "\tMsg=".$api->errorMessage."\n";
} else {
echo "Returned: ".$retval."\n";