Hello, I'm struggling with the php api. I have the api key and access token working perfectly. When I try to do any request, like this one: private function get_main_list() {
try {
$lists = $this->cc->getLists($this->ACCESS_TOKEN);
foreach ($lists as $list) {
if(strcasecmp($list->name, 'General Interest') && $list->status === 'ACTIVE') {
return $list;
}
}
} catch(CtctException $ex) {
print("Exception on list");
print_r($ex->getErrors());
}
} I'm hiting the exception, and the message is the craziest thing: Exception on listArray ( [0] => Array ( [id] => 1982645563 [name] => Just Liz [status] => HIDDEN [created_date] => 2014-05-24T20:38:28.000Z [modified_date] => 2014-05-24T16:38:28.000-04:00 [contact_count] => 1 ) [1] => Array ( [id] => 1 [name] => General Interest [status] => ACTIVE [created_date] => 2011-01-27T02:02:06.000Z [modified_date] => 2013-07-22T04:07:46.000-04:00 [contact_count] => 203 ) [2] => Array ( [id] => 1309207977 [name] => Communication Series [status] => HIDDEN [created_date] => 2014-04-06T13:25:35.000Z [modified_date] => 2014-04-06T09:25:51.000-04:00 [contact_count] => 19 ) [3] => Array ( [id] => 1731330293 [name] => Windsor Workshop Autoresponder [status] => HIDDEN [created_date] => 2014-09-24T16:15:25.000Z [modified_date] => 2014-09-24T12:15:25.000-04:00 [contact_count] => 32 ) ) It's returning the actual content I want... but I is it throwing the exception? Am I doing something wrong? In another piece of code where I'm not catching the exception this is what I get: public function add_email($email) {
$response = $this->cc->getContactByEmail($this->ACCESS_TOKEN, $email);
if(empty($response->results)) {
$contact = new Contact();
$contact->addEmail($email);
$contact->addList($this->main_list);
$cc->addContact($this->ACCESS_TOKEN, $contact, true);
return true;
}
return false;
} Fatal error: Uncaught exception 'Ctct\Exceptions\CtctException' with message '{"meta":{"pagination":{}},"results":[]}' in /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php:94 Stack trace: #0 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php(22): Ctct\Util\RestClient::httpRequest('https://api.con...', 'GET', Array) #1 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Services/ContactService.php(28): Ctct\Util\RestClient->get('https://api.con...', Array) #2 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/ConstantContact.php(143): Ctct\Services\ContactService->getContacts('9c91e23c-4c19-4...', Array) #3 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/constantcontact.php(30): Ctct\ConstantContact->getContactByEmail('9c91e23c-4c19-4...', 'jpaulo.motta@gm...') #4 /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/page-article-download.php(38): TbtConstantContact->add_email('j in /nas/wp/www/staging/bt301/wp-content/themes/businesstherapist/lib/Ctct/Util/RestClient.php on line 94 This is driving me crazy. I would appreciate any help. Thank you.
... View more