two issues: response time and list display order (checkboxes)

Occasional Participant

two issues: response time and list display order (checkboxes)


I am using the PHP samples and have integrated them into our website and have noticed two things:

  1. When accessing add_contact.php or edit_contact.php (the only two sample files we are using for our purposes), the response time is really slow.  I have tried many things including triggering a waiting indicator on click to the page that shows these files, but as soon as the top of the page loads,

    the indicator goes away--so there is no real possible way to do an indicator.


  2. In the cc_class.php file, I added two more lists to the array for which lists I want to show on the form and it does not follow the order of the array.  I want to make it display certain lists before other lists.  How can I achieve this?

Please let me know what you need from me to assist.  Thank you!



Are add_contact or edit_contact actually adding and updating the contact, or are you receiving an error message? I just did some testing with a number of operations using our API and have not seen any slow response times. 


Regarding forcing the form to display your lists in a certain order, the sample forms show your contact lists displayed in the order they were retrieved from the server, which is in the order that they were created. However you do have two options for customizing which lists are going to be displayed:


1- You could use the contact list options included at the top of cc_class to specify which lists will or will not be available for sign up, but this does not modify the order in which the lists are displayed. This would consist of modifying $doNotIncludeLists (line 35) or $contact_lists (line 18) variables.


2- Our API does return a <SortOrder> node with a GET on the lists collection ({user-name}/lists) which you could use to display the lists in a specified order. This is the node that our user interface at uses to change the order in which lists are displayed. Unfortunately this functionality is not built into our PHP sample pack at this time.

David J

Occasional Participant

I am basically trying to use the appropriate form based on whether the user is or isn't a current contact--logically, it is opening up the lists the user is subscribed to (if they are a contact) and allows them to modify their selections.


I include the class and check to see if the email address loaded into the current login session is in the constant contact DB:


$ccOBJ = new ConstantContact();
if (!empty($_SESSION)) {
    $contact = $ccOBJ->getSubscribers(urlencode($_SESSION));
    if (empty($contact) || empty($_SESSION)) {
        $is_contact = false;
        //header('Location: simple_form.php?email='.urlencode($_POST));       
    else {
        $is_contact = true;
        //header('Location: edit_contact.php?email='.urlencode($_POST));       


Then, I'm including the add_contact or edit_contact (named add_my_contact.php and edit_my_contact.php, respectively, for use in the "My Subscriptions" portal on our site) based on the boolean value of $is_contact.


if($is_contact) { ?>
                    <p>The email address <strong><?php echo $_SESSION; ?></strong> has been located in our mailing lists. Below is a listing of the current e-newletters that you receive. To add your email address to another list, please check the box next to the e-newsletter you would like to subscribe to. To remove your email address from a particular e-newsletter, simply uncheck the box next to the corresponding e-newsletter.</p>
                    <?php include($v3Path."/includes/classes/ConstantContact/edit_my_contact.php");
                } else { ?>
                    <p>Would you like to receive e-newsletters from AAA that contain valuable information and enticing special deals? Sign up below by choosing which e-newsletters you would like to receive from the list.<br />
                    <span class="small em">Our records indicate your email address is <strong><?php echo $_SESSION; ?></strong>. Your email address has been pre-populated using your account profile information. If you would like to receive these e-newsletters through a different email address, you must <a href="<?php echo $v3linkURL; ?>/portal/Account/Profile">update your Account with the new address</a>.</span></p>
                    <?php include($v3Path."/includes/classes/ConstantContact/add_my_contact.php");
Developer Portal

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

Visit Page