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.

Store PHP wrapper library errors


Store PHP wrapper library errors

Hi All,


I'm wondering if there's  way to store the errors produced by the php wrapper library, rather than having them automatically thrown to the browser.  I can check for existing users and deal with it that way, but there might be other errors I don't need the user seeing, and it breaks the rest of my page.


Constant Contact HTTP Request Exception: Error 409: Email address test3@example.com is already a contact

Like I said I can check for this, but I don't want anything like the above output to the browser. 


I'm using the following and tried using ob_start() and ob_get_contents() to prevent this but the class itself throws there error and kills everything else.


$NewContact = $ConstantContact->addContact($Contact);


Is there a setting I'm missing?


Thanks in advance,



Hi Jason,


Sorry, but the wrapper was only configured to throw errors to the browser.  You'd have to really dig into error handling in the wrapper to suppress all errors.  I can say that the 409 (duplicate entry) and 400 errors are by far the most common errors, so if you account for those in your code, you likely won't see many other types of errors.  


Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page