listUnsubscribeContacts
public static integer listUnsubscribeContacts(string token, string listID, array contacts)
Unsubscribe the contacts from the given contact list.
| Parameters |
| string token | A valid token for your account. To generate a token, use the login method. |
| string listID | The contact list ID in which to unsubscrib contacts. To get all the contact lists, use the listGet method. |
| array contacts | The string array containing the contact details. |
| Returns |
| integer | Returns the total number of contacts which are active in the list. |
- <?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'];
-
- /**
- Prepare the data to unsubscribe.
- **/
- $rec[0] = "user1@___.com";
- $rec[1] = "user2@___.com";
-
- $active = $client->listUnsubscribeContacts($token, $listID, $rec);
-
- echo $active . " active records in the list.";
- ?>