function cc::query_campaigns in Constant Contact 6.3
Same name and namespace in other branches
- 6.2 class.cc.php \cc::query_campaigns()
- 7.3 class.cc.php \cc::query_campaigns()
* This queries the API for campaigns with a certain status * Supported status codes are: * SENT All campaigns that have been sent and not currently scheduled for resend * SCHEDULED All campaigns that are currently scheduled to be sent some time in the future * DRAFT All campaigns that have not yet been scheduled for delivery * RUNNING All campaigns that are currently being processed and delivered * * @access public
File
- ./
class.cc.php, line 1430
Class
- cc
- @file
Code
function query_campaigns($status = 'SENT') {
$xml = $this
->load_url('campaigns?status=' . urlencode($status));
if (!$xml) {
return false;
}
// parse into nicer array
$campaigns = array();
$_campaigns = isset($xml['feed']['entry']) ? $xml['feed']['entry'] : false;
if (is_array($_campaigns)) {
if (isset($_campaigns[0]['link_attr']['href'])) {
foreach ($_campaigns as $k => $v) {
$id = $this
->get_id_from_link($v['link_attr']['href']);
$campaign = $v['content']['Campaign'];
$campaign['id'] = $id;
$campaigns[] = $campaign;
}
}
else {
$id = $this
->get_id_from_link($_campaigns['link_attr']['href']);
$campaign = $_campaigns['content']['Campaign'];
$campaign['id'] = $id;
$campaigns[] = $campaign;
}
}
return $campaigns;
}