listUpdateContactDetails
public static array listUpdateContactDetails(string token, string listID, string contactID, array contactDetail)
Update the given contact in the list based on the details provided.
| 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 contactID | The contact ID which you want to update. To get the contact ID from a list in your account, use the listGetContacts method. |
| array contactDetail | The array containing the details for the contact. To refer to the existing structure in the list, use the listGetContactDetails method. |
| Returns |
| array | Returns an array with the contact details. |
- <?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'];
-
- /**
- Fetch the first contact records, so we can retrieve the Email to fetch the details.
- **/
- $contact = $client->listGetContacts($token, $listID, "", 1, 1, "", "");
- $contactEmail = $contact[0]['email'];
-
- $contactDetail = $client->listGetContactDetails($token, $listID, $contactEmail);
- $contactID = $contactDetail['id'];
- $contactDetail['Company Name'] = "ACME";
- $contactDetail['FirstName'] = "Clark";
- $contactDetail['LastName'] = "Kent";
-
- $updatedDetail = $client->listUpdateContactDetails($token, $listID, $contactID, $contactDetail);
- foreach($updatedDetail as $key => $value) {
- echo $key . ": " . $value . "<br />";
- }
-
- ?>