public static array listGetContactsByType(string token, string listID, string filter, integer pageNumber, integer pageSize, string orderBy, string sortOrder,string Type)
Get the contacts from the contact list according to Type of Contacts.
Contact List Related Methods

string tokenA valid token for your account. To generate a token, use the login method.
string listIDThe contact list ID from which you want to retrieve records. To get the contact lists in your account, use the listGet method.
string filterShow contacts where the email address contains with the filter
integer pageNumberFetch results from the given page number.
integer pageSizeNumber of results per page.
string orderBySort the results based on "email" or "date".
string sortOrderSort the results in the "asc"ending or "desc"ending order.
string TypeThe Type of the Contacts required ie Optin,NotOptedIn,ConfirmedBounces,Active,Unsubscribe

arrayReturns an array with the results.

Return Structure
integer sequenceThe sequence number of the record
string idThe ID of the contact
string emailEmail Address of the contact. To get all the details for the contact, use the listGetContactDetails method.
string firstnameFirst name of the contact
string middlenameMiddle name of the contact
string lastnameLast name of the contact

download example code

  1. <?php
  2. /**
  3. This Example shows how to authenticate a user 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.php';
  8. $client = XML_RPC2_Client::create($apiURL);
  9. $token = $client->login($apiLogin, $apiPassword);
  10. /**
  11. Fetch the latest contact list, so we can retrieve the contact list ID.
  12. **/
  13. $contactList = $client->listGet($token, "", 1, 1, "", "");
  14. $listID = $contactList[0]['id'];
  16. $type="Optin";
  17. $contacts = $client->listGetContactsByType($token, $listID, "", 1, 100, "", "",$type);
  19. foreach($contacts as $rec) {
  20.     echo $rec['sequence'] . "] Email: " . $rec['email'] . "(" . $rec['id'] . ")";
  21.     echo "\t Name:" . $rec['firstname'] . " " . $rec['middlename'] . " " . $rec['lastname'];
  22.     echo "<br />";
  23. }
  25. ?>