Showing results for 
Search instead for 
Did you mean: 

Sign Up information is not getting stored

Sign Up information is not getting stored


We have client which uses the ConstantContact API for the storing the sign up information and sending email. The contacts were getting saved properly before some time, but suddenly it has stopped storing the information of the signed up contact. Will you please let me know how can I look into this issue and which approach to be used. Since this was working before i feel that something at the Constantcontact API or site is changed, if not please help me out in getting a solution for this.

Valued Developer

re: Signup Information

There are plenty of possible reasons. The first things I would consider are:

  • Has the username or password on the Constant Contact account changed? Both are used in the script to add Contacts.

  • Has the Contact List which the contacts are added to been deleted or renamed? That would break it.

Next, you should look at the script itself. Make sure that the script is trapping errors returned on the API call. Once you have more details on the specific error codes and messages, please post here again.

Tom M
Group Product Manager – Content Editing
Constant Contact

Want to store contact information with constantcontact

HI Tom,

Thanks for a quick reply. My client is holding an account with you. They want to implement a functionality to store the contact information with constant contact so that later on the email's can be send to the customers present in the contact list. Please let me know how can I go ahead with the imlpementation wise. Which API to use just to save the username and the email address with ?

Username: lesliejones
It's bit urgent. Waiting for a quick reply.

Valued Developer

re: Sign Up Information (Storing)

Hello Manjushree,

If your customer is simply looking to upload a contact every now and then, you should consider the Yahoo widget.

If you are looking to create an application which stores a single contact, or a few contacts at a time, you should use the Contacts Resource. There are several language specific examples of the use of this API in this forum, including a PHP example in this thread.

If you are looking to upload a list of contacts in a single operation (ie. a bulk upload), you will want to use the Activities Resource. You can find examples of the use of this resource both in the forums, and on this page.

(If you have a Site Visitor API based integration that was working before and is no longer working - consider starting with the troubleshooting comments made in my earlier post. The Site Visitor API is an alternative approach to adding contacts and should still work for you).

Tom M
Group Product Manager – Content Editing
Constant Contact

Having Similar issue

Hey, I am having a similar issue with my API form. We created an API class that collects data from a form, but I am having problems getting it to login and submit the info to Constant Contact.

Here is the info I am using (with the personal info omitted of course) :

$form->account_username = "accountname"; // CONSTANT CONTACT ACCOUNT INFO //
$form->account_password = "accountpassword"; // CONSTANT CONTACT ACCOUNT INFO //
$form->account_key = " apikeyr23423948234890908%accountname"; // CONSTANT CONTACT ACCOUNT INFO //

is there something else that should be included in the login information?

Valued Developer

re: Having a similar issue

Can you describe what the error is? What response code are you getting from the server? Are you using account_key as the username in your post?

Tom M
Group Product Manager – Content Editing
Constant Contact

Here is the code that I am using

Below are the scripts I am using for this API. The first is the class script we generated:

. ''
. '


$request ="" . $this->account_username . "/contacts";
$session = curl_init($request);
$userNamePassword = $this->account_key . '%' . $this->account_username . ':' . $this->account_password ;

curl_setopt($session, CURLOPT_USERPWD, $userNamePassword);
curl_setopt($session, CURLOPT_POST, 1);
curl_setopt($session, CURLOPT_POSTFIELDS , $entry);
curl_setopt($session, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml"));
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($session);

$template = ob_get_contents();

$send_email = mail($this->form_email, $this->email_subject, $template, $this->email_headers);


header("Location: " . $this->email_return_path);





Below is the actual form with the class variables. I have removed anything that is specific to our account, but this should give you an idea of what we are doing:


// execute only if form is sent - determined by the hidden form value "sent" //

// include class //

// create new instance of form_send class //
$form = new form_send;

// set up class properties //
$form->form_first_name = trim(stripslashes($_POST));
$form->form_last_name = trim(stripslashes($_POST));
$form->form_email = trim(stripslashes($_POST));
$form->form_month = trim(stripslashes($_POST));
$form->form_day = trim(stripslashes($_POST));
$form->form_expire = date("l, F j, Y", mktime(0, 0, 0, date("m") , date("d")+28, date("Y"))); // can be altered an may not be needed for all forms //

$form->account_username = "ourusername"; // CONSTANT CONTACT ACCOUNT INFO //
$form->account_password = "ourpassword"; // CONSTANT CONTACT ACCOUNT INFO //
$form->account_key = " apicode-numbers-gohe-reandthensome%ourusername"; // CONSTANT CONTACT ACCOUNT INFO //

$form->email_subject = "Thank you for joining ourstuff"; // your email subject line here //
$form->email_template = "mail.templates/index.php"; // path to mailo template - relative to this file not the class //
$form->email_headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n" . 'From: ourstuff' . "\r\n"; // headers for html email
$form->email_return_path = "thank-you.php"; // return path can be absolute or relative to document //

// Now execute the send by calling send_and_return method //




Untitled Document









When i go to the account manager, I cannot find my submission in the Awaiting Confirmation field and I don't get a second opt in email. I do get our custom email, which I am going to probably have to remove until after they click on the second opt in email. I would be interested in knowing if anyone has a sample of sending the second opt in email and if it can be customized, but more importantly i want to get this form hooked up so that it adds users to the database.


Solution Provider

RE: Here is the code that I am using

I see two issues with your code.

The first issue is with Your XML Data you are posting. The following is wrong

<Email>' . $this->form_email . '</Email>

It should be

<EmailAddress>' . $this->form_email . ' </EmailAddress>

The second issue I see is with this line

$form->account_key = "apicode-numbers-gohe-reandthensome%ourusername"; // CONSTANT CONTACT ACCOUNT INFO //

It should be


If your code does not work after making the following changes then please echo your $response so you can see what the error is.

Mike C Support Engineer, Constant Contact


I get a 401 error...

Hey, i made the changes you suggested and I get a 401 error. Is there a list of what the errors mean? Thanks!
Valued Developer

re: 401 Error

This is an authentication error. Typically, there is a mistake in your the Constant Contact username / password you are providing, a problem with the API key or the URI you are trying to access is not consistent with the Constant Contact username you are providing.

Summary of error codes can be found here.

Tom M
Group Product Manager – Content Editing
Constant Contact
Still need help?
You can post a new message in the Community or find us on Twitter Mon-Fri 8am - 8pm ET. We've got real people waiting to help you out. Click below to start a conversation!