当前位置: 首页>>代码示例>>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;未经允许,请勿转载。