当前位置: 首页>>代码示例>>PHP>>正文


PHP MCAPI::campaignSchedule方法代码示例

本文整理汇总了PHP中MCAPI::campaignSchedule方法的典型用法代码示例。如果您正苦于以下问题:PHP MCAPI::campaignSchedule方法的具体用法?PHP MCAPI::campaignSchedule怎么用?PHP MCAPI::campaignSchedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MCAPI的用法示例。


在下文中一共展示了MCAPI::campaignSchedule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MCAPI

<?php

/**
This Example shows how to schedule a campaign for future delivery
via the MCAPI class.
**/
require_once '../mcapi.php';
require_once 'config/config.inc.php';
//contains apikey
$api = new MCAPI($apikey);
$schedule_for = '2018-04-01 09:05:21';
$retval = $api->campaignSchedule($campaignId, $schedule_for);
if ($api->errorCode) {
    echo "Unable to Schedule Campaign!";
    echo "\n\tCode=" . $api->errorCode;
    echo "\n\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Campaign Scheduled to be delivered {$schedule_for}!\n";
}
开发者ID:siesqo,项目名称:mailchimp-php-api,代码行数:19,代码来源:mcapi_campaignSchedule.php

示例2: send_campaign

 public function send_campaign()
 {
     $expected = array('db', 'lang', 'send_time', 'num_subscribers', 'action');
     if (!$_POST) {
         exit;
     }
     $this->campaign = array();
     foreach ($_POST as $post => $value) {
         if (in_array($post, $expected)) {
             $this->campaign[$post] = $value;
         }
     }
     $host = $this->host;
     $lang = $this->campaign['lang'];
     $db = $this->campaign['db'];
     $action = $this->campaign['action'];
     $send_time = $this->campaign['send_time'];
     $api_key = $this->get_setting('api_key');
     $html = $this->get_file("{$host}?lang={$lang}&production");
     $html = $this->filter_html_campaign_code($html);
     $campaign_type = $this->get_setting('type');
     $formatted_db_name = str_replace('_', ' ', strtoupper($db));
     //add into the $opts this EDMs specifics:
     $opts = $this->get_setting('options');
     $opts['list_id'] = $this->get_setting('prod_list');
     $opts['title'] .= ' ' . $formatted_db_name;
     $opts['subject'] = $this->extract_html_subject($html);
     //add tracking code
     $year = date('Y');
     $db_key = strtoupper($db);
     $opts['analytics'] = array('google' => $this->get_setting('campaign_name') . '_' . $year . '_' . $db_key);
     $opts['authenticate'] = true;
     $segment_opts = array('match' => 'all', 'conditions' => $this->get_mailchimp_sending_criteria($db));
     $api = new MCAPI($api_key);
     $campaign_id = $api->campaignCreate($campaign_type, $opts, array('html' => $html), $segment_opts);
     if ($action === 'schedule') {
         $local = $this->get_send_time_and_offset(false, false, $send_time);
         $tmp = strtotime($send_time) - $local['total_offset'];
         $send_time = date('Y-m-d H:i:s', $tmp);
         $campaign_id = $api->campaignSchedule($campaign_id, $send_time);
     }
     if ($api->errorCode) {
         $this->send_json(array('fail' => $api->errorMessage));
     } else {
         $this->set_cache($campaign_id);
         $this->send_json(array('success' => $campaign_id));
     }
     exit;
 }
开发者ID:sidouglas,项目名称:aussieBumEDM,代码行数:49,代码来源:create.campaign.php


注:本文中的MCAPI::campaignSchedule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。