segmentGetContacts
public static array segmentGetContacts(string token, string segmentID, string filter, integer pageNumber, integer pageSize, string orderBy, string sortOrder)
Get the contacts from the segment.
Parameters
|
string token | A valid token for your account. To generate a token, use the login method. |
string segmentID | The segment ID from which you want to retrieve records. To get the segments in your account, use the segmentGet 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. |
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 segment list, so we can retrieve the segment ID.
- **/
- $segmentLists = $client->segmentGet($token, "", 1, 1, "");
- $segmentID = $segmentLists[0]['id'];
-
- $contacts = $client->segmentGetContacts($token, $segmentID, "", 1, 100, "");
-
- foreach($contacts as $rec) {
- echo $rec['sequence'] . "] Email: " . $rec['email'] . "(" . $rec['id'] . ")";
- echo "\t Name:" . $rec['firstname'] . " " . $rec['middlename'] . " " . $rec['lastname'];
- echo "<br />";
- }
-
- ?>