Back to Documentation Overview

listMembers

public static listMembers(string uid, string id, string status, int start, int limit)

Get all of the list members of a list that are of a particular status

Section:
List Related
Parameters:
uid the id for your user account. Get by calling login($user, $pass)
id the list id to connect to
status the status to get members for - one of(subscribed, unsubscribed, or cleaned), defaults to subscribed
start optional - , for large data sets, the page number to start at - defaults to 1st page of data (page 0)
limit optional - , for large data sets, the number of results to return - defaults to 100, upper limit set at 15000
Returns:
array   -  Array of list member structs (see Returned Fields for details)
Returned Fields:
string email Member email address
date timestamp timestamp of their associated status(date subscribed, unsubscribed, or cleaned)

Examples (1)

download example code

[1] mcapi_listMembers.php

  1. <?php
  2. /**
  3. This Example shows how to pull the Members of a List using the MCAPI.php
  4. class and do some basic error checking.
  5. **/
  6.  
  7. // Include the MailChimp API code. Do Not Edit This!
  8. include('inc/MCAPI.class.php');
  9. include('inc/config.inc.php'); //contains username & password
  10.  
  11. // Connect to the MailChimp server with the user's credentials.
  12. $acct = new MCAPI($mailChimpUser, $mailChimpPass);
  13.  
  14. $retval = $acct->listMembers( $listId , 'subscribed', 0, 5000 );
  15.  
  16. if (!$retval){
  17. echo "Unable to load listMembers()!";
  18. echo "\n\tCode=".$acct->errorCode;
  19. echo "\n\tMsg=".$acct->errorMessage."\n";
  20. echo "Members returned: ". sizeof($retval). "\n";
  21. } else {
  22. echo "Members returned: ". sizeof($retval). "\n";
  23. }
  24.  
  25. ?>
  26.  
Add New Note User Contributed Notes for listMembers
No notes, yet... Will you be the first??