[英]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.