Campaign Monitor php sdk - 添加订阅错误 - 不再显示在列表中

Campaign Monitor php sdk - add Subscribe bug - no longer showing on list

我正在开发一个活动监视器 api,它创建一个带有自定义字段的自定义列表。

当我尝试添加订阅者时它曾经有效,现在当我查看列表时它没有添加它们。虽然它仍然返回成功代码 201.

function addSubscriber($list_id, $emailAddress, $name, $title, $showName, $showDate, $showTime){
    //create subscriber
    $subscriber = array(
        'EmailAddress' => $emailAddress,
        'Name' => $name,
        'CustomFields' => array(
            array(
                'Key' => "Title",
                'Value' => $title
            ),
            array(
                'Key' => "ShowName",
                'Value' => $showName
            ),
            array(
                'Key' => "ShowDate",
                'Value' => $showDate
            ),
            array(
                'Key' => "ShowTime",
                'Value' => $showTime
            )
        ),
        'Resubscribe' => true,
        'RestartSubscriptionBasedAutoResponders' => true
    );

    //print_r($subscriber);

    $subwrap = new CS_REST_Subscribers($list_id, $this->auth);
    $result = $subwrap->add($subscriber); 
    //var_dump($result->response);

    echo "Result of POST /api/v3.1/subscribers/{list id}.{format}\n<br />";
    if($result->was_successful()) {
        echo "Subscribed with code ".$result->http_status_code;
    } else {
        echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
        var_dump($result->response);
        echo '</pre>';
    }
    return $result->response;
}

此代码适用于 me.You 需要在您的项目文件夹中添加活动监视器 class 文件并使用有效的列表 ID api key.You 可以找到您 api 来自 管理帐户 link 的键和来自点击列表标题下方(更改 name/type)的列表 ID。请稍等片刻才能在您的列表中看到。

require_once 'csrest_subscribers.php';


$name=$_POST['name'];
$email=$_POST['email'];


$wrap = new CS_REST_Subscribers('Your list ID', 'Your API Key');
$result = $wrap->add(array(
    'EmailAddress' => $email,
    'Name' => $name,
    'CustomFields' => array(), // no custom fields, can remove this line completely
    'Resubscribe' => true
));


echo "Result of POST /api/v3/subscribers/{list id}.{format}\n<br />";
if($result->was_successful()) {
    echo "Subscribed with code ".$result->http_status_code;
} else {
    echo 'Failed with code '.$result->http_status_code."\n<br /><pre>";
    var_dump($result->response);
    echo '</pre>';
}