We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

API cc_class showing errors suddenly..

Occasional Participant

API cc_class showing errors suddenly..

I'm about to go live and suddenly getting cc_class errors and my contacts are not being added to list.  Please advice asap as I'm about to go live with new website.


Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/xxxxx//html/includes/lib/constantcontact/cc_class.php on line 156


Warning: Invalid argument supplied for foreach() in /home/xxxx/public_html/xxxxx//html/includes/lib/constantcontact/cc_class.php on line 168


No code has changed and it has been working fine for several weeks.  Did you change the base version of this code that is creating these errors?


This is my test site but my prodution url/domain is giving same error.





These are warnings rather than errors, and have been happening in the PHP sample for a while, depending on what call you are making and what data is being returned. It appears that the two warnings that you posted are retrieving lists from your account, as well as any 'links' contained in the lists collection (link to the next page of lists perhaps). This should not however prevent any functionality from completing as they are not fatal errors.  Typically, I would recommend that you turn error messaging off in a production enviornment anyway which can be done by using:




at the top of you page. You can also set this globally in your php.ini file.


As our API's have not been updated, If your error message settings are the same in your development or production environments, then the change must be the account data being returned. If this is not adding any contacts to your account, I would need to see:

1) your account name

2) an example email address that is not being added

3) the code you are using to add the contact.


You can either reply to this thread with that information, or send it over to our webservices team, and we'll be happy to take a look. Thanks!

David J

Occasional Participant

Hi - I've sent email with the information. Thanks.

I just wanted to respond and let you know I have received your email, and will respond as soon as I've got any news for you. In the mean time, if you have any other questions please let me know. Thanks!

David J

Occasional Participant

Ok.  Thanks.  Let me know if you need anything else.  I will continue to research on my end.  I'm sending you copy of my cc_class.php file as well.

Developer Portal

View API documentation, code samples, get your API key.

Visit Page