You are here

function cc::create_list in Constant Contact 6.3

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

* Creates a new contact list * * * @access public

File

./class.cc.php, line 549

Class

cc
@file

Code

function create_list($name, $default = "false", $sort_order = 99) {

  // build the XML post data
  $xml_post = '<entry xmlns="http://www.w3.org/2005/Atom">
  <id>data:,</id>
  <title/>
  <author/>
  <updated>2008-04-16</updated>
  <content type="application/vnd.ctct+xml">
    <ContactList xmlns="http://ws.constantcontact.com/ns/1.0/">
      <OptInDefault>' . $default . '</OptInDefault>
      <Name>' . $name . '</Name>
      <SortOrder>' . $sort_order . '</SortOrder>
    </ContactList>
  </content>
</entry>';
  $this
    ->http_set_content_type('application/atom+xml');
  $xml = $this
    ->load_url("lists", 'post', $xml_post, 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']);
  		endif;
  */
  return false;
}