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.

409 error being inserted in page with <head tags - wordpress page loaded


409 error being inserted in page with <head tags - wordpress page loaded

I've got the constant contact api working ok, but if I try  to submit a duplicate email address, I get a The requested URL returned error: 409 which means duplicate, yeah, but this text is being inserted into my <body> with part of a wordpress page with it.  Like I get that message and then a bunch of css and js head tags.  Inserted into the page that I'm working with.  I'm doing this from wordpress and I can see that the page being inserted is part of a wordpress page.


here's my body tag and the error msg


<body class="centered">
The requested URL returned error: 409 

  then there's all this

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <title>Contact Us | cos ipad fb</title>

<link rel="stylesheet" type="text/css" media="all" href="http://cosipadfb/cos-ipad-fb/wp-content/themes/cos-ipad-fb/style.css">

<link rel="pingback" href="http://cosipadfb/cos-ipad-fb/xmlrpc.php">
<link rel="icon" type="image/png" href="/CSAS-favicon.png">
	<link rel="alternate" type="application/rss+xml" title="cos ipad fb » Contact Us Comments Feed" href="http://cosipadfb/cos-ipad-fb/contact-us/feed/">
<script type="text/javascript" src="http://cosipadfb/cos-ipad-fb/wp-includes/js/jquery/jquery.js?ver=1.7.1"></script>
<script type="text/javascript" src="http://cosipadfb/cos-ipad-fb/wp-content/themes/cos-ipad-fb/script/jquery.clearfield.js?ver=3.3.1"></script>
<script type="text/javascript" src="http://cosipadfb/cos-ipad-fb/wp-content/themes/cos-ipad-fb/script/public.js?ver=3.3.1"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://cosipadfb/cos-ipad-fb/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://cosipadfb/cos-ipad-fb/wp-includes/wlwmanifest.xml"> 
<link rel="prev" title="home" href="http://cosipadfb/cos-ipad-fb/">
<meta name="generator" content="WordPress 3.3.1">
 <!--  template-home.php   xxxxxxx  --> 
<!-- choose sub tpl -->

<div id="main"

 and that's my main div tag, and then the rest of my page.  (if youre wondering why my links look like http://cosipad/ it's because i am deving locally with alias and modded hosts file) 


any clues?


Hey Don,


I'd assume from the messaging that you're using a Wordpress site. Did you put together this module using any premade forms or libraries? It's hard to tell without seeing the code, but it looks like the connection is attempting to return the full HTTP response into your page as an echo, which has a body tag in it. The Wordpress script will probably then scramble to insert what it needs to be in there. Turning off the echo of the HTTP response would probably disable this.


It's a little difficult to do a full troubleshoot on this without the code, however. If you would like, you can send your modifications as attachments to webservices@constantcontact.com, so we can review your code and see if there's anything we can turn up from there.

Nick Galbraith
Support Engineer

Howdy, yes on the wordpress.  No on premade scripts.  Unsure what you mean about "Turning off the echo of the HTTP response" Unless you mean that i am explicitly echoing that which i am not.


I found the trigger, if not the actual cause, and have fixed the problem

Not sure of the exact cause, but the trigger is sending an empty var to


If that method gets a real email address, things are normal.


so, I had a bug in my code which was giving subscriberExists() an empty variable, this is what causes the page info to be inserted into the actual page.  If i give it an email address, it works fine.

I believe that this is caused as a side effect of how error handling is done with this library.  All errors from cURL are caught and echoed back to the page.  I'm betting when this is combined with Wordpress, the result is your main page being shown with just the echoed error message as the content from Constant Contact.  You'd just need to change the way errors are handled in the exception handling portion of the library to adjust to how you want to handle errors instead.

Dave Berard
Senior Product Manager, Constant Contact

If you are using the Contact Contact API library look for $curl_debug in the CC_Utility class. It was set to true by default in the version I downloaded and I had the same issues as you. Just set it to false and then it won't echo any content automatically when an API error occurs. You should handle all errors by checking the function return value and the $lastError value after making an API call.
Developer Portal

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

Visit Page