通过mailchimp api 2.0将复选框值数组发送到mailchimp [英] send array of checkbox values to mailchimp via mailchimp api 2.0

查看:78
本文介绍了通过mailchimp api 2.0将复选框值数组发送到mailchimp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此Mailchimp 2.0 PHP包装器:

I'm using this Mailchimp 2.0 PHP wrapper:

https://github.com/drewm/mailchimp-api

通过Mailchimp 2.0 API将数据发送到我的列表中.

To send data to my list via the Mailchimp 2.0 API.

我可以获取电子邮件,名字和姓氏,以将其成功地从表单发送到mailchimp.

I can get email, firstname, and lastname to send successfully from my form to mailchimp.

我将这些设置为mailchimp(EMAIL,FNAME,LNAME)中的必填字段.

I set those up as required fields in mailchimp(EMAIL, FNAME, LNAME).

这是用于此的PHP:

$MailChimp = new MailChimp('xxxxxxx');
$result = $MailChimp->call('lists/subscribe', array(
'id'                => 'xxxxxx',
//required fields
'email'             => array( 'email' => $_POST['email']),
'merge_vars'        => array('FNAME' => $_POST['fname'], 'LNAME' => $_POST['lname']),
//mailchimp options
'double_optin'      => false,   
'update_existing'   => true,
'replace_interests' => false

));

但是我还有12个复选框,用于选择引擎大小,类型,气体类型,颜色等内容.

But I also have 12 checkboxes for stuff like engine size, type, gas type, color, etc. that are optional.

如何将它们发送到mailchimp API?我希望有Mailchimp API经验的人能帮上忙.

How can send these to the mailchimp API? I'm hoping someone with experience with Mailchimp API could help out.

任何帮助将不胜感激.

谢谢!

推荐答案

以下是文档示例中未列出的分组结构的说明. IE.您只提供用户已选择的组的名称:

Here is a clarification to the structure of the groupings that is not in the docs' example. I.e. you supply only the names of the groups that have been selected by the user:

"merge_vars": {
       "groupings": [
           {
               "groups": [
                   "selection 3",
                   "selection 7"
               ],
               "id": <group_id>// or "name": <group_name>
           }
       ]
   },

这篇关于通过mailchimp api 2.0将复选框值数组发送到mailchimp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆