簡體   English   中英

MailChimp API 2.0現有電子郵件地址的錯誤響應

[英]MailChimp API 2.0 Error Response for existing E-Mail Address

我試圖從MailChimp獲得響應以向訂閱者返回消息。 訂閱工作正常,但我沒有得到MailChimp的任何回復。 我是PHP的Noob,所以我需要使用JSON,還是像我的PHP代碼一樣?

$MailChimp = new \drewm\MailChimp('12122338484487841-us1');
$result = $MailChimp->call('lists/subscribe', array(
        'id'                => '1123334444',
        'email'             => array('email'=>$check_mail['customers_email_address']),
        'merge_vars'        => array('FNAME'=>$check_mail['customers_firstname'], 'LNAME'=>$check_mail['customers_lastname']),
        'double_optin'      => true,
        'update_existing'   => false,
        'replace_interests' => false,
        'send_welcome'      => true,
));     

// CHECK MAILCHIMP IF EMAIL EXIST
if( $result === false ) {
    return 'You have already subscribed to the List';
}
else if( isset($result->status) && $result->status == 'error' ) {
    // Error info: $result->status, $result->code, $result->name, $result->error
}
// CHECK MAILCHIMP IF EMAIL EXIST           

謝謝

很酷,那么你可以查一下..

if( $result['name'] === 'List_AlreadySubscribed' ) {
    return $result['error'];// which returns "mail@example.com is already subscribed to list SyncTest. Click here to update your profile." as a string.
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM