You are here

function MCAPI::MCAPI in Mailchimp 5

Same name and namespace in other branches
  1. 5.2 MCAPI.class.php \MCAPI::MCAPI()
  2. 6.2 MCAPI.class.php \MCAPI::MCAPI()
  3. 6 MCAPI.class.php \MCAPI::MCAPI()
  4. 7 MCAPI.class.php \MCAPI::MCAPI()

Connect to the MailChimp API for a given list. All MCAPI calls require login before functioning

Parameters

string $username Your MailChimp login user name - always required:

string $password Your MailChimp login password - always required:

File

./MCAPI.class.php, line 34

Class

MCAPI

Code

function MCAPI($username, $password) {

  //do more "caching" of the uuid for those people that keep instantiating this...
  $this->apiUrl = parse_url("http://api.mailchimp.com/" . $this->version . "/?output=php");
  if (isset($GLOBALS["mc_api_key"]) && $GLOBALS["mc_api_key"] != "") {
    $this->api_key = $GLOBALS["mc_api_key"];
  }
  else {
    $this->api_key = $this
      ->callServer("login", array(
      "username" => $username,
      "password" => $password,
    ));
    $GLOBALS["mc_api_key"] = $this->api_key;
  }
}