}
     // if/else service status
     debugServiceSeparator($service_id, false);
 }
 // CONSTANTCONTACT
 /**************************************************************************************
  * GETRESPONSE API
  **************************************************************************************/
 if (!empty($cfg['getresponse']['apikey']) && !empty($cfg['getresponse']['lists'])) {
     $service_id = 'getresponse';
     debugServiceSeparator($service_id, true);
     $service_requirements_status = $cfgenwpapi_obj->checkServiceRequirements($service_id);
     if ($service_requirements_status['status']) {
         require '../api/getresponse/GetResponseAPI.class.php';
         $getresponse_api = new GetResponse($cfg[$service_id]['apikey']);
         $getresponse_ping = $getresponse_api->ping();
         if ($getresponse_ping == 'pong') {
             foreach ($cfg[$service_id]['lists'] as $list_v) {
                 $list_id = $list_v['list_id'];
                 $getresponse_contact = array();
                 $getresponse_contact['email'] = '';
                 $getresponse_contact['name'] = '';
                 $getresponse_contact['customfields'] = array();
                 // FIELDS
                 if (!empty($list_v['fields'])) {
                     foreach ($list_v['fields'] as $field_v) {
                         if ($field_v['list_field_id'] == 'email' || $field_v['list_field_id'] == 'name') {
                             // 'name' IS a mandatory field
                             $getresponse_contact[$field_v['list_field_id']] = getElementValue($field_v['element_id']);
                         }
                         if ($field_v['list_field_id'] != 'email' && $field_v['list_field_id'] != 'name') {
<?php

require_once 'GetResponseAPI.class.php';
$api = new GetResponse('YOUR_API_KEY');
// 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
 /**
  * Checks validity of GetResponse API key and initializes API if valid.
  *
  * @return bool|null
  */
 public function initialize_api()
 {
     if (!is_null($this->api)) {
         return true;
     }
     /* Load the GetResponse API library. Class has been modified to make some functions public. */
     if (!class_exists('GetResponse')) {
         require_once 'api/GetResponseAPI.class.php';
     }
     /* Get the plugin settings */
     $settings = $this->get_plugin_settings();
     /* If the API key is empty, return null. */
     if (rgblank($settings['api_key'])) {
         return null;
     }
     $this->log_debug(__METHOD__ . "(): Validating login for API Info for key {$settings['api_key']}.");
     $getresponse = new GetResponse($settings['api_key']);
     /* Run authentication test request. */
     if ($getresponse->ping() == 'pong') {
         /* Log that test passed. */
         $this->log_debug(__METHOD__ . '(): API Key is valid.');
         /* Assign GetResponse object to the class. */
         $this->api = $getresponse;
         return true;
     } else {
         $this->log_error(__METHOD__ . '(): Invalid API Key.');
         return false;
     }
 }