listGetContactsByType
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.
| Parameters |
| string token | A valid token for your account. To generate a token, use the login method. |
| string listID | The contact list ID from which you want to retrieve records. To get the contact lists in your account, use the listGet method. |
| string filter | Show contacts where the email address contains with the filter |
| integer pageNumber | Fetch results from the given page number. |
| integer pageSize | Number of results per page. |
| string orderBy | Sort the results based on "email" or "date". |
| string sortOrder | Sort the results in the "asc"ending or "desc"ending order. |
| string Type | The Type of the Contacts required ie Optin,NotOptedIn,ConfirmedBounces,Active,Unsubscribe |
| Returns |
| array | Returns an array with the results. |
| Return Structure |
| integer sequence | The sequence number of the record |
| string id | The ID of the contact |
| string email | Email Address of the contact. To get all the details for the contact, use the listGetContactDetails method. |
| string firstname | First name of the contact |
| string middlename | Middle name of the contact |
| string lastname | Last name of the contact |
- <?php
- /**
- This Example shows how to authenticate a user using XML-RPC.
- Note that we are using the PEAR XML-RPC client and recommend others do as well.
- **/
- require_once 'XML/RPC2/Client.php';
- require_once 'inc/config.php';
- $client = XML_RPC2_Client::create($apiURL);
- $token = $client->login($apiLogin, $apiPassword);
- /**
- Fetch the latest contact list, so we can retrieve the contact list ID.
- **/
- $contactList = $client->listGet($token, "", 1, 1, "", "");
- $listID = $contactList[0]['id'];
-
- $type="Optin";
- $contacts = $client->listGetContactsByType($token, $listID, "", 1, 100, "", "",$type);
-
- foreach($contacts as $rec) {
- echo $rec['sequence'] . "] Email: " . $rec['email'] . "(" . $rec['id'] . ")";
- echo "\t Name:" . $rec['firstname'] . " " . $rec['middlename'] . " " . $rec['lastname'];
- echo "<br />";
- }
-
- ?>