public function __construct($apiKey, $listID) { // handles module registration in UserBase parent::__construct(); $this->apiKey = $apiKey; $this->listID = $listID; $pos = strpos($apiKey, '-'); if ($pos === FALSE) { throw new MailChimpException("Wrong API key. Expected '-' in it somewhere."); } $datacenter = substr($apiKey, $pos + 1); $this->endpoint = 'http://' . $datacenter . '.api.mailchimp.com/1.3/'; }