/** * Public function that sends a POST request that creates an Export Contact Activity, returns exported activity * * @param string $filetype - either CSV or TXT file to upload * @param object $list - valid list object * @param string $exportOptDate - true to include the Add/Remove Date in the export file, false to not include it * @param string $exportOptSource - true to include the Added/Removed By (source of add or remove) in the export file, false to not include it * @param string exportListName - true to include the List Name in the export file, false to not include it * @param string sortBy - EMAIL_ADDRESS to sort the list by email address in ascending order. DATE_DESC will sort the contacts by the Date in descending order * @return object $activity with full details of the created activity object */ public function exportContacts($filetype, $list, $exportOptDate, $exportOptSource, $exportListName, $sortBy, $columns = array()) { $utility = new CTCTUtility(); $call = $utility->getApiPath() . '/ws/customers/' . $utility->getLogin() . '/activities'; foreach ($columns as $item) { $allColumns .= '&columns=' . urlencode($item); } $urlEncodedPost = "activityType=EXPORT_CONTACTS&fileType=" . $filetype . "&exportOptDate=" . $exportOptDate . "&exportOptSource=" . $exportOptSource . "&exportListName=" . $exportListName . "&sortBy=" . $sortBy . $allColumns . "&listId=" . urlencode($list->getId()); $activityXml = $utility->urlEncodedPost($call, $urlEncodedPost); $activity = $this->createActivityStruct($activityXml); return $activity; }