« Back to Documentation Overview

listMemberInfo – v1.1

 listMemberInfo(string apikey, string id, string email_address)

Get all the information for a particular member of a list

Section
List Related
Parameters
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()
email_address the member email address to get information for
Returns
array array of list member info (see Returned Fields for details)
Returned Fields
stringemailThe email address associated with this record
stringemail_typeThe type of emails this customer asked to get: html or text
arraymergesAn associative array of all the merge tags and the data for those tags for this email address. Note: Interest Groups are returned as comma delimited strings - if a group name contains a comma, it will be escaped with a backslash. ie, "," => "\,"
stringstatusThe subscription status for this email address, either subscribed, unsubscribed or cleaned
stringip_optIP Address this address opted in from.
stringip_signupIP Address this address signed up from.
datetimestampThe time this email address was added to the list

Examples (2)

download example code

[1] mcapi_listMemberInfo.php

  1. <?php
  2. /**
  3. This Example shows how to pull the Info for a Member of a List using the MCAPI.php
  4. class and do some basic error checking.
  5. **/
  6. require_once 'inc/MCAPI.class.php';
  7. require_once 'inc/config.inc.php'; //contains apikey
  8.  
  9. $api = new MCAPI($apikey);
  10.  
  11. $retval = $api->listMemberInfo( $listId, $my_email );
  12.  
  13. if ($api->errorCode){
  14. echo "Unable to load listMemberInfo()!\n";
  15. echo "\tCode=".$api->errorCode."\n";
  16. echo "\tMsg=".$api->errorMessage."\n";
  17. } else {
  18. echo "Member info:\n";
  19. //below is stupid code specific to what is returned
  20. //Don't actually do something like this.
  21. foreach($retval as $k=>$v){
  22. if (is_array($v)){
  23. //handle the merges
  24. foreach($v as $l=>$w){
  25. echo "\t$l = $w\n";
  26. }
  27. } else {
  28. echo "$k = $v\n";
  29. }
  30. }
  31. }
  32.  

[2] xml-rpc_listMemberInfo.php

  1. <?php
  2. /**
  3. This Example shows how to retrieve a list subscriber's information using XML-RPC
  4. Note that we are using the PEAR XML-RPC client and recommend others do as well.
  5. **/
  6. require_once 'XML/RPC2/Client.php';
  7. require_once 'inc/config.inc.php';
  8. try {
  9. $client = XML_RPC2_Client::create($apiUrl);
  10.  
  11. $result = $client->listMemberInfo($apikey, $listId, $my_email);
  12. echo "SUCCESS! \n";
  13. echo "Info for: ".$result['email']."\n";
  14. echo " Email Type: ".$result['email_type']."\n";
  15. echo " Status: ".$result['status']."\n";
  16. echo " Timestamp: ".$result['timestamp']."\n";
  17. echo " Merges:\n";
  18. foreach($result['merges'] as $k=>$v){
  19. echo "\t$k = $v\n";
  20. }
  21. } catch (XML_RPC2_FaultException $e){
  22. echo "ERROR!!!!\n";
  23. echo 'code: '.$e->getFaultCode()."\n";
  24. echo 'msg : '.$e->getFaultString()."\n";
  25. }
  26.  
  27.