The requested URL returned error: 400

Regular Participant

The requested URL returned error: 400


I am trying to get the basic contact form to work. I'm starting with the files straight out of your  "" and modifying only the "cc_class.php" by adding username, password, and api key. I also set the debug to "true". When I upload everything to a test folder, the form comes up nicely and has pulled down the "Interests list" successfully populated.

However, as soon as I click on the submit button it throws a "The requested URL returned error: 400"

I'm figuring that I am missing something probably basic...  But I can't figure just what it is...

Sure hope you can help!




Hi Ken,

I have downloaded the same version of the sample form as you are using and am only able to replicate your issue if I do not choose a list for the contact to be added to. Please make sure to choose a list when adding a contact and confirm with us whether or not the issue is still occurring.


The reason that you would be receiving a 400 error is because the XML being generated to create the contact requires that a contact list be specified. If one is not present, the API returns an error and the web form is not set up to display that error to the user without the use of the debug option.


If this suggestion does not resolve your issue please give more detail as to what form you are using to add the contact (Add a new Contact Full, Add a new contact simplified, edit contact...) and what form fields you are filling out (first name, address...)

Dan H

Support Engineer, Constant Contact

Regular Participant

Hi Dan,

I am using the simple_form.php.  Here is some further info...

In the cc_class.php file I am making the following changes...

        var $login = 'caseydawes'; //username for your account

        var $password = 'xxxxxxx'; //password for your account

        var $apikey = 'properAPIkey entered here'; // Api Key for your account.

        var $curl_debug = true; //set this to true to see the response code returned by cURL

        var $contact_lists = array(WiseWomanShining); // define which lists will be available for signup.

        var $force_lists = true; //  set this to true to take away the ability for users to select and unselect lists

        var $show_contact_lists = false; //  set this to false to hide the list name(s) on the signup form.

From the documentation, I would expect this to work. It doesn't. WiseWomanShining is a valid list name in the account. I have tried the array with nothing (), with 'WiseWomanShining', even its list ID number, 28 to no avail


Here's what does work...

If I set the contact list to empty   i.e.  var $contact_lists = array();  and set force_lists to false and show_contact_lists to true

and then attempt to run the form by selecting a list checkbox, entering email, first and last names and then submit, the form works properly.

If I run the form (configured as above) without an email entered it throws the "An error has occured" and the (debug) 400 error (shouldn't it explain the error to the user nicely with something like "Please enter a valid email address" or whatever is missing?)

If it helps, I have the form set up as a test bed at the following url -

Does this help clarify?





Hey Ken,

At first glance it appeared as though this error may be cause by the lack of quotes around the list name like so: var $contact_lists = array("WiseWomanShining"); however this is not the case as I was able to specify one of my lists without quotes and it did work.

After looking at your test bed it appears as though the logic is functioning correctly however the script is not able to locate a list with that name and thus is forming bad XML when you attempt to submit it. There is a lack of robust error messaging in the sample as it is just that, a sample script. I will possibly add error checking and messaging when there are no found lists however at this time you should just verify by testing.

I looked into the 'caseydawes' account and I cannot find a list titled 'WiseWomanShining' nor can I find a list with an id of 28. I did however find a 'WiseWomanCircle' list with an id of 2. Please note that you cannot specify an ID in the contact_lists array you can only use names.

Try specifying 'WiseWomanCircle' as your list in the contact_lists array and try it with quotes just to make sure. Let me know how it works out.

Dan H

Support Engineer, Constant Contact

Regular Participant

I'm experiencing the same problem described in the message that started this thread, but I'm definitely getting the name right. I can turn off or on the list of  names with the same effect.  I'm using simple_form.php with the bare configuration and nothing fancy.

Thanks for any clues.

p.s. I've also sent a message to the maintainers of this Drupal site to ask them to fix a bug in the email configuration for Drupal or PHP. Your envelope sender is from a non-existent domain, so my servers kick the email right back. I managed to create the account here by adding a temporary bogus entry to my server's /etc/hosts file. Contact me at if I'm not replying here, as I certainly won't get any email notifications from this server.


Thank you for reporting the Drupal configuration issue.  Our admin team is looking into this now.  I will have one of our PHP support engineers follow up with you regarding the other issue and hopefully help you out there as well.

Dave Berard
Senior Product Manager, Constant Contact

I have looked over our code to see if there is a potential flaw however it appears to be working correctly for me. I would recommend that you test by creating a simple one-word list and attempt to display that one list. Secondly make sure that you are spelling the list name correctly as it is case sensitive and may not work correctly if there are any addition characters in the list name such as html or spaces.


If you still cannot get it to work, please send an email to Web Services containing your account username (so that I can view your list names) and the code that you are using for the cc_class.php and simple_form.php files.

Dan H

Support Engineer, Constant Contact

Developer Portal

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

Visit Page