dongzi9196 2013-09-23 12:53
浏览 165

如何获取每个列表订阅状态的Mailchimp会员信息?

How to get the Mailchimp member information with each list subscribtion status?

$mailChimp = new MCAPI($this->api_key);
$listid = 'xxxxxxxxxx';
$retval = $mailChimp->listMemberInfo( $listid, 'yourname@gmail.com' );

if ($this->_mailChimp->errorCode) {
   $error['Code'] = $this->_mailChimp->errorCode;
   $error['Message'] = $this->_mailChimp->errorMessage;
   return $error;
}

print_r($retval);

Return array:

Array
(
    [id]        => xxxxxxxxxx
    [email]     => yourname@gmail.com
    [email_type]=> html
    [ip_opt]    => xxx.xxx.xxx.xxx
    [ip_signup] => 
    [member_rating] => 2
    [info_changed] => 2013-09-23 12:08:28
    [web_id]    => xxxxxxxx
    [merges]    => Array
        (
            [EMAIL]  => yourname@gmail.com
            [MERGE0] => yourname@gmail.com
            [FNAME]  => Firstname
            [MERGE1] => Firstname
            [LNAME]  => Lastname
            [MERGE2] => Lastname
        )

    [status]    => unsubscribed
    [timestamp] => 2013-09-23 12:08:28
    [lists]     => Array
        (
            [xxxxxxxxxx] => subscribed
            [xxxxxxxxxx] => subscribed
            [xxxxxxxxxx] => subscribed
        )
)

But here I don't know how to check that which List I have subscribed and Which is Unsubscribed. Because

[lists]     => Array
    (
        [xxxxxxxxxx] => subscribed
        [xxxxxxxxxx] => subscribed
        [xxxxxxxxxx] => subscribed
    )

Here all the lists are not match with my Original Lists Id getting list using

lists() method of Mailchimp

$retval = $mailChimp->lists();

Can anyone has idea how to check that my email id: 'yourname@gmail.com' has subscribed to this lists and unsubscribed to this list.

I want to know the status of each list by given List_ID and Email_ID

I have used PHP as technology.

  • 写回答

1条回答 默认 最新

  • dsklfsdlkf1232 2014-01-17 14:08
    关注

    I realise this is an old question, but for future visitors:

    For version 2 of the API (the Mailchimp class has public $root = 'https://api.mailchimp.com/2.0';), this works for me:

    $MailChimp = new Mailchimp('YOUR_MAILCHIMP_API_KEY');
    $lists = $MailChimp->helper->listsForEmail(array("email" => $email));
    

    You'll need appropriate error checking; for example, it'll throw a Mailchimp_List_NotSubscribed if the email address isn't subscribed to any lists.

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程