Пример #1
0
         }
     } catch (Exception $oException) {
         // Catch any exceptions
         echo json_encode(array("status" => "error", "type" => "Looks like something went wrong. Please try again later."));
         $oiErrors = $oiContact->getErrors();
         foreach ($oiErrors as $key => $value) {
             errorlog("icontact", $value);
         }
     }
 } elseif ($STORE_MODE == "constantcontact") {
     $list_name = $CC_LIST_NAME;
     $list_id = null;
     $cc = new Ctct\ConstantContact($CC_API_KEY);
     try {
         try {
             $lists = $cc->getLists($CC_ACCESS_TOKEN);
             if (is_array($lists) && sizeof($lists) > 0) {
                 foreach ($lists as $key => $value) {
                     if (isset($value->name) && $value->name == $list_name) {
                         $list_id = $value->id;
                     }
                 }
             }
             if (isset($email) && strlen($email) > 1 && $list_id != null) {
                 $action = "Getting Contact By Email Address";
                 try {
                     // check to see if a contact with the email addess already exists in the account
                     $response = $cc->getContactByEmail($CC_ACCESS_TOKEN, $email);
                     // create a new contact if one does not exist
                     if (empty($response->results)) {
                         $action = "Creating Contact";