// Connection Testing $ping = $api->ping(); var_dump($ping); // Account $details = $api->getAccountInfo(); var_dump($details); // Campaigns $campaigns = (array) $api->getCampaigns(); $campaignIDs = array_keys($campaigns); $campaign = $api->getCampaignByID($campaignIDs[0]); var_dump($campaigns, $campaign); // Contacts $contacts = (array) $api->getContacts(null); $contactIDs = array_keys($contacts); $setName = $api->setContactName($contactIDs[0], 'John Smith'); $setCustoms = $api->setContactCustoms($contactIDs[0], array('title' => 'Mr', 'middle_name' => 'Fred')); $customs = $api->getContactCustoms($contactIDs[0]); $contact = $api->getContactByID($contactIDs[0]); $geoIP = $api->getContactGeoIP($contactIDs[0]); $opens = $api->getContactOpens($contactIDs[0]); $clicks = $api->getContactClicks($contactIDs[0]); // Find the contact ID by using email ID and delete the contact $contactEmail = (array) $api->getContactsByEmail('EMAIL_ID'); $contactEmailID = array_keys($contactEmail); $deleteResponse = $api->deleteContact($contactEmailID[0]); var_dump($contacts, $setName, $setCustoms, $customs, $contact, $geoIP, $opens, $clicks); // Blacklists $addBlacklist = $api->addAccountBlacklist('*****@*****.**'); $getBlacklist = $api->getAccountBlacklist(); $delBlacklist = $api->deleteAccountBlacklist('*****@*****.**'); var_dump($addBlacklist, $getBlacklist, $delBlacklist);
} if ($field_v['list_field_id'] != 'email' && $field_v['list_field_id'] != 'name') { // If a custom field is set with an empty value, the contact won't be added // Any custom field that is added must have a value in order to add the contact in the list if ($element_ids_values[$field_v['element_id']]['element_value'][0]) { // for customfields in add procedure $getresponse_contact['customfields'][] = array('name' => $field_v['list_field_id'], 'content' => getElementValue($field_v['element_id'])); // for customfields in update procedure $gr_update_contact_customs[$field_v['list_field_id']] = getElementValue($field_v['element_id']); } } } $getresponse_add = ''; // SEARCH CONTACT if ($getresponse_contact['email'] && $getresponse_contact['name']) { $gr_search_res = $getresponse_api->getContactsByEmail($getresponse_contact['email'], array($list_id), $operator = 'EQUALS'); if ($contactform_obj->cfg['debug']) { echo 'SEARCH RESULTS in (list_id)' . $list_id . "\r\n"; print_r($gr_search_res); echo "\r\n"; } $gr_search_res_arr = (array) $gr_search_res; // ^-- we use a temp variable with the search results casted as an array because $gr_search_res is an object and it is not possible to check if an object is empty (if empty: add, if not: update) // ADD if (!$gr_search_res_arr) { $getresponse_add = $getresponse_api->addContact($list_id, $getresponse_contact['name'], $getresponse_contact['email'], $action = 'standard', $cycle_day = 0, $getresponse_contact['customfields']); if ($contactform_obj->cfg['debug']) { echo 'ADD CONTACT ' . "\r\n"; print_r($getresponse_add); echo "\r\n"; }