php - How can I add that subscribe to different segments? -


i want add subscriber different segment signup source. create 2 segment in mailchimp. how can add subscribe different segments? using api v2.

<?php   include('mailchimp.class.php');    $mailchimp = new \drewm\mailchimp('ebae376c690e50d98ce069482eec5244-us8');   $result = $mailchimp->call('lists/subscribe', array(     'id'                => 'fde03148a4',     'email'             => array( 'email' => $_post['email'] ),     'merge_vars'        => array(     'merge2' => $_post['name'] // merge name list settings     // there merge fields must set if required in list settings   ),   'double_optin'      => true,   'update_existing'   => false,   'replace_interests' => false )); if( $result === false ) {     // response wasn't json } else if( isset($result->status) && $result->status == 'error' ) {     echo $result->status, $result->code, $result->name, $result->error; } ?> 

from api docs: you'll need add groupings item merge_vars array. should array of associative arrays id , groups array names of groups want add user to.

in v3, bit easier. there's interests object takes ids , booleans determine if user added or removed group.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -