} } /** * Remove the addresses property to prevent error message * If a contact has 3 addresses that were created using the online dashboard, and if this contact gets updated using the Constant Contact API, * the following error message is thrown away: * json.max.items.violation #/addresses: 3 items were contained, but the maximum number of items allowed is 2 * (after using getContactByEmail, all the current addresses are returned in $response->results[0], therefore we must remove the property addresses in order to run updateContact properly) **/ unset($cc_contact->addresses); if ($contactform_obj->cfg['debug']) { echo 'UPDATE CONTACT' . "\r\n"; echo 'Contact data to send' . "\r\n"; print_r($cc_contact); } $returnContact = $cc->updateContact($cfg[$service_id]['accesstoken'], $cc_contact, true); if ($contactform_obj->cfg['debug']) { echo 'Server:' . "\r\n"; print_r($returnContact); } } } } catch (Exception $e) { $cc_error = $e->getErrors(); if ($contactform_obj->cfg['debug']) { print_r($cc_error); } $admin_api_error[$service_id]['error_code'] = $cc_error[0]['error_key']; $admin_api_error[$service_id]['error_message'] = $cc_error[0]['error_message']; } } else {