簡體   English   中英

MailChimp API更新列表詳細信息

[英]MailChimp API to Update List Details

在我們網站的第1頁,我們使用mailchimp API將用戶電子郵件和其他一些細節插入到mailchimp列表中。

現在問題。 在稍后的頁面上,我們想要更新該人的mailchimp記錄並包含一些其他信息。需要一些UPDATE API編碼的幫助。

謝謝你的幫助。

干杯

這是我們的插入編碼:

 ** Store email to MailChimp database - start **/
   require_once('MCAPI.class.php');
   // grab an API Key from http://admin.mailchimp.com/account/api/
   $api = new MCAPI('XXXXXXXXXXXXXXXXXXXXXX');

   // grab your List's Unique Id by going to http://admin.mailchimp.com/lists/
   // Click the "settings" link for the list - the Unique Id is at the bottom of that page. 
   $list_id = "XXXXXXXXXXXXXXXXXXXXXX";

   $merge_vars = array('NAME'=> GetSQLValueString($_POST['name']), 'START'=>               GetSQLValueString($_POST['start']), 'SITE'=> GetSQLValueString($_POST['site']));

   if($api->listSubscribe($list_id, GetSQLValueString($_POST['email_address']), $merge_vars, 'html', FALSE) === true) {
     // It worked!
   }else{
     // An error ocurred, return error message - Don't uncomment this one
     //echo "Unable to load listSubscribe()!\n";
    //echo "\tCode=".$api->errorCode."\n";
    //echo "\tMsg=".$api->errorMessage."\n";
    //exit();
   }
   /** Store email to MailChimp database - end **/

您可以使用listSubscribe方法。

listSubscribe(string apikey, string id, string email_address, 
              array merge_vars, string email_type, bool double_optin, 
              bool update_existing, bool replace_interests, bool send_welcome)

確保您將update_existing設置為TRUE。

它將更新訂閱列表中的現有條目。

暫無
暫無

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

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