« Back to Documentation OverviewlistMembers – v1.1
listMembers(string apikey, string id, string status, integer start, integer limit)
Get all of the list members for a list that are of a particular status
| Parameters | mcapi_listMembers.php| apikey | a valid API Key for your user account. Get by calling Get by visiting your API dashboard |
| id | the list id to connect to. Get by calling lists() |
| 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
<?php
/**
This Example shows how to pull the Members of a List using the MCAPI.php
class and do some basic error checking.
**/
require_once 'inc/MCAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey
$api = new MCAPI($apikey);
$retval = $api->listMembers($listId, 'subscribed', 0, 5000 );
if ($api->errorCode){
echo "\n\tCode=".$api->errorCode; echo "\n\tMsg=".$api->errorMessage."\n"; } else {
foreach($retval as $member){
echo $member['email']." - ".$member['timestamp']."\n"; }
}
?>