8

我需要通过 api 检索所有用户信息,在我发现的文档中查找它: http ://apidocs.mailchimp.com/api/2.0/lists/member-info.php

这是我的代码:

$params = array(
            'id' => $list_id,
            'emails' => array(
                            'euid' => $member_id,
                        ),
        );
        $infos = $this->MailChimp->call('lists/member-info', $params);

print_r($infos);

这是结果:

Array ( [success_count] => 0 [error_count] => 1 [errors] => Array ( [0] => Array ( [email] => 63a885b7cf [error] => "email" should be a struct [code] => -100 ) ) [data] => Array ( ) )  

“电子邮件”应该是一个结构是什么意思?

4

3 回答 3

11

这也有效并且稍微简单一些:

$result = $MailChimp->call('lists/member-info', array(
            'id'        => $list_id,
            'emails'    => array(array('email'=>$email))
          ));

上面的例子使用了这个 API:https ://github.com/drewm/mailchimp-api/

于 2014-01-03T01:26:12.673 回答
9

解决了!我的$params数组是错误的。

MailChimp 需要这样的数组格式:

$params = array(
            'id' => $list_id,
            'emails' => array(
                          0 => array(
                              'euid' => $member_id,
                          ),
                        ),
        );
于 2013-09-24T09:33:21.040 回答
3

我的做法如下:

array(
  '0' => array('email' => $mail1)
  '1' => array('email' => $mail2)
  ...
  ...
);

谢谢,

于 2014-07-23T11:53:07.430 回答