You are here

function cc::export_contacts in Constant Contact 7.3

Same name and namespace in other branches
  1. 6.3 class.cc.php \cc::export_contacts()
  2. 6.2 class.cc.php \cc::export_contacts()

Creates a new export contacts activity.

It returns the activity ID to use to check the status. *

@access public

Parameters

array An array: fieldnames to export: see fieldnames.html:

int The ID of the list to export:

string The format of the export, either CSV or TXT:

File

./class.cc.php, line 1126
Constant Contact PHP Class

Class

cc
@file Constant Contact PHP Class

Code

function export_contacts($list_id, $export_type = 'CSV', $columns = array(), $sort_by = 'DATE_DESC') {
  if (!is_array($columns) || !count($columns)) {
    $columns = $this
      ->get_export_file_columns();
  }
  $params['activityType'] = 'EXPORT_CONTACTS';
  $params['fileType'] = $export_type;
  $params['exportOptDate'] = 'true';
  $params['exportOptSource'] = 'true';
  $params['exportListName'] = 'false';
  $params['sortBy'] = $sort_by;
  $params['columns'] = $columns;
  $params['listId'] = $this
    ->get_list_url($list_id);
  $this
    ->http_set_content_type('application/x-www-form-urlencoded');
  $xml = $this
    ->load_url("activities", 'post', $params, 201);
  if ($xml) {
    return TRUE;
  }

  /*
  if(isset($this->http_response_headers['Location']) && trim($this->http_response_headers['Location']) != ''){
      return $this->get_id_from_link($this->http_response_headers['Location']);
  }
  */
  return FALSE;
}