The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

HTTP Response Code '403'Received: JBoss Web/2.1.2.GA - Error report

New Member

HTTP Response Code '403'Received: JBoss Web/2.1.2.GA - Error report

$ch = curl_init();

$theXML='<entry xmlns="">

<title type="text"></title>




<summary type="text">Contact</summary>

<content type="application/vnd.ctct+xml">

<Contact xmlns="">




<ContactList id="" />





$UN = "NIRCH100";


$Key = "blah blah";

$userNamePassword = $Key . '%' . $UN . ':' . $PW;


curl_setopt($ch, CURLOPT_USERPWD, $userNamePassword);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS , $theXML);

curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml"));

curl_setopt($ch, CURLOPT_HEADER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt($ch, CURLOPT_URL, '');

$content = curl_exec($ch);

echo"------------------ ADD CONTACT ------------------";

echo "Connecting to '".str_replace('http://', 'https://', '');

echo "And Posting:<pre>\n\n---START---\n". htmlspecialchars($theXML) ."\n---END---\n\n</pre>";

echo "HTTP Response Code '".curl_getinfo($ch, CURLINFO_HTTP_CODE)."'";

echo "Received:<pre>\n\n---START---\n". htmlspecialchars($content) ."\n---END---\n\n</pre><br><br>";


Kindly help me out to find where I am missing as the above code does not add a contact.

The reponse: HTTP Response Code '403'Received:  JBoss Web/2.1.2.GA - Error report


Error 403

Error 403 typically means that you are trying to access a URI collection that you do not have permission to access. I tested the code that you posted and was able to replicate the error you were receiving. After looking at your code, I noticed the URL you are making the request to is using 'username' in place of your actual username (or the variable you are using to store your username). If you make the modification below, this should resolve your issue.


Try changing:


curl_setopt($ch, CURLOPT_URL, '');




curl_setopt($ch, CURLOPT_URL, ''.$UN.'/contacts');


I hope this helps, please let us know if you have any other questions.

David J

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More