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.

no xml returned

Occasional Contributor

no xml returned

I can't figure out what I'm doing wrong here. Can someone take a look at this code and tell me why NOTHING is being returned?


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $eurl);
curl_setopt($ch, CURLOPT_USERPWD, $authstr);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);
curl_setopt($ch, CURLOPT_HTTPGET, 1);
curl_setopt($ch, CURLOPT_HEADER, 0); // Do not return headers
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml", 'Content-Length: ' . strlen($parameter)));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If you set this to 0, it will take you to a page with the http response
curl_setopt($ch, CURLINFO_HEADER_OUT, false);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$return = curl_exec($ch);
$xml = simplexml_load_string($return);
print $xml;

Occasional Contributor

Re: no xml returned


Occasional Contributor

Re: no xml returned

I've finally got *something* going here.

I output my xml string: $return = curl_exec($ch);


Then put it into a SimpleXML variable.


$xml = new SimpleXMLElement($return);


Now I can parse it, using this, for instance:

echo $xml->entry->author->name;

which returns back the correct string: Constant Contact


However, I can't parse ANYTHING inside of the entry->content node.

echo $xml->entry->content->EmailAddress;

Nothing gets sent back.


Why not? Any ideas?


Re: no xml returned



I was looking at your code when you went "bump," but hadn't found the issue.  I am going to try to troubleshoot the code you just provided to see if I can find the reason it's not returning anything, but it just might take some time (just as I suspect it is on your side as well).  I will post back here with updates.


Best Regards,

Shannon W.

API Support Specialist


Re: no xml returned

Hey Kevin,


Would love to see a print_r of the return variable to see exactly what we are working with that needs to be parsed out.  If you could post that here, that would be great.  


We have a PHP lib that would lighten the work load you have to deal with such as XML parsing and cURL which can be found here:


You just include one file in your project and your ready.


Let us know how you want to proceed and we can continue looking at your cURL settings and assist with parsing out the return.



Andrew Weber
Associate Product Manager for EventSpot
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