當前位置: 首頁>>代碼示例>>PHP>>正文


PHP jsonRPCClient::delete_contact方法代碼示例

本文整理匯總了PHP中jsonRPCClient::delete_contact方法的典型用法代碼示例。如果您正苦於以下問題:PHP jsonRPCClient::delete_contact方法的具體用法?PHP jsonRPCClient::delete_contact怎麽用?PHP jsonRPCClient::delete_contact使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在jsonRPCClient的用法示例。


在下文中一共展示了jsonRPCClient::delete_contact方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: AutoResponderGetResponseAPI

 function AutoResponderGetResponseAPI($that, $ar, $wpm_id, $email, $unsub = false)
 {
     global $wpdb;
     require_once $that->pluginDir . '/extlib/jsonRPCClient.php';
     if ($ar['campaign'][$wpm_id]) {
         $campaign = trim($ar['campaign'][$wpm_id]);
         $name = trim($that->ARSender['name']);
         $email = trim($that->ARSender['email']);
         $api_key = trim($ar['apikey']);
         $api_url = empty($ar['api_url']) ? "http://api2.getresponse.com" : trim($ar['api_url']);
         $grUnsub = $ar['grUnsub'][$wpm_id] == 1 ? true : false;
         $uid = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE `user_email`='" . esc_sql($that->ARSender['email']) . "'");
         $ip = trim($that->Get_UserMeta($uid, 'wpm_login_ip'));
         $ip = $ip ? $ip : trim($that->Get_UserMeta($uid, 'wpm_registration_ip'));
         $ip = $ip ? $ip : trim($_SERVER['REMOTE_ADDR']);
         try {
             if (!extension_loaded('curl') || !extension_loaded('json')) {
                 # these extensions are a must
                 throw new Exception("CURL and JSON are modules required to use" . " the GetResponse Integration");
             }
             $api = new jsonRPCClient($api_url);
             #get the campaign id
             $resp = $api->get_campaigns($api_key);
             $cid = null;
             if (!empty($resp)) {
                 foreach ($resp as $i => $item) {
                     if (strtolower($item['name']) == strtolower($campaign)) {
                         $cid = $i;
                     }
                 }
             }
             if (empty($cid)) {
                 throw new Exception("Could not find campaign {$campaign}");
             }
             if ($unsub) {
                 if ($grUnsub) {
                     //list contacts
                     $contacts = $api->get_contacts($api_key, array('campaigns' => array($cid), 'email' => array('EQUALS' => "{$email}")));
                     if (empty($contacts)) {
                         #could not find the contact, nothing to remove
                         return;
                     }
                     $pid = key($contacts);
                     $res = $api->delete_contact($api_key, array('contact' => $pid));
                     if (empty($res)) {
                         throw new Exception("Empty server response while deleting contact");
                     }
                 }
             } else {
                 $resp = $api->add_contact($api_key, array('campaign' => $cid, 'name' => $name, 'email' => $email, 'ip' => $ip, 'cycle_day' => 0));
                 if (empty($resp)) {
                     throw new Exception("Empty server response while sending");
                 }
             }
         } catch (Exception $e) {
             return;
         }
     }
 }
開發者ID:brooklyntri,項目名稱:btc-plugins,代碼行數:59,代碼來源:integration.autoresponder.getresponseapi.php


注:本文中的jsonRPCClient::delete_contact方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。