Hello there !
I have my customized form in website. And hooked this form to Constant Contact account by using API. I am using addContact.php code which was provided.
After submitting my from, The contact information will go to my database and then it will goto constant contact account. Contact info is going to my database always but not going to CC account sometimes. It's happened with few times.
Contacts are not going to my account in sometimes. But most of the cases contacts are going to my account. Can anyone help me, How to fix this ?
Contacts should go to my account always but sometimes its missing....
Below is my code:
$ConstantContact = new ConstantContact('basic', $apiKey, $username, $password);
$ContactLists = $ConstantContact->getLists();
$results = $ConstantContact->searchContactsByEmail($c_email);
if($results[0]){
$Contact = $results[0];
$Contact->emailAddress = $c_email;
$Contact->firstName = $c_fname;
$Contact->lastName = $c_lname;
$Contact->lists = array($specific_list);
//array_merge($Contact->lists,$specific_list);
$Contact->notes = $c_msg;
$Contact->workPhone = $c_phno;
$Contact->city = $c_city;
$Contact->postalCode = $c_zip;
$Contact->countryName = $c_country;
$Contact->stateName = $c_state;
$Contact->optInSource = 'ACTION_BY_CONTACT';
$NewContact = $ConstantContact->updateContact($Contact);
}else{
$Contact = new Contact();
$Contact->emailAddress = $c_email;
$Contact->firstName = $c_fname;
$Contact->lastName = $c_lname;
$Contact->lists = array($specific_list);
$Contact->notes = $c_msg;
$Contact->workPhone = $c_phno;
$Contact->city = $c_city;
$Contact->postalCode = $c_zip;
$Contact->countryName = $c_country;
$Contact->stateName = $c_state;
$Contact->optInSource = 'ACTION_BY_CONTACT';
$NewContact = $ConstantContact->addContact($Contact);
}
Any help will be appreciated !
Regards,
Thiru !
Hi Thiru,
Certainly, your code looks good to me. We'll need some additional information about what is happening when the failures happen. If you can post the error code you get when the contact is NOT added, that could help.
Otherwise, we can look at specific cases of failure. Could you send the following information to webservices@constantcontact.com so that we can help investigate?
Thanks in advance!
Best Regards,
Shannon W.
API Support Specialist