public static function donation_button_infusionsoft_handler($posted) { $is_api_key = get_option("infusionsoft_api_key"); $app_name = get_option("infusionsoft_api_app_name"); $is_list_id = get_option("infusionsoft_lists"); $fname = isset($posted['first_name']) ? $posted['first_name'] : ''; $lname = isset($posted['last_name']) ? $posted['last_name'] : ''; $email = isset($posted['payer_email']) ? $posted['payer_email'] : $posted['receiver_email']; $debug = get_option('log_enable_infusionsoft') == 'yes' ? 'yes' : 'no'; if ('yes' == $debug) { $log = new Donation_Button_Logger(); } if (isset($is_api_key) && !empty($is_api_key) && (isset($app_name) && !empty($app_name)) && (isset($is_list_id) && !empty($is_list_id))) { include_once DBP_PLUGIN_DIR_PATH . '/admin/partials/lib/infusionsoft/isdk.php'; $app = new iSDK(); try { if ($app->cfgCon($app_name, $is_api_key)) { $contactid = $app->addCon(array('FirstName' => $fname, 'LastName' => $lname, 'Email' => $email)); $infusionsoft_result = $app->campAssign($contactid, $is_list_id); if ('yes' == $debug) { $log->add('Infusionsoft', print_r($infusionsoft_result, true)); } } } catch (Exception $e) { if ('yes' == $debug) { $log->add('Infusionsoft', print_r($e, true)); } } } }
<?php require_once "../src/isdk.php"; $app = new iSDK(); if ($app->cfgCon("connectionName")) { echo "connected<br/>"; echo "app connected<br/>"; $cid = 36; $groupId = 99; $result = $app->grpAssign($cid, $groupId); echo "tag applied to contact . " . $cid . "<br/>"; $campId = 83; $result = $app->campAssign($cid, $campId); echo "Added " . $cid . " to Followup Sequence " . $campId . "<br/>"; } else { echo "Connection Failed"; }