Jump to content

I need help with a nested array


Presto-X

Recommended Posts

Hello everyone,

 

I'm trying to pull a list of email campaigns from constant contact and display them on our site,

 

require_once('ctctWrapper.php');
$data = new CampaignsCollection();
$campaigns = $data->listCampaigns();
foreach ($campaigns as $campaign) {
foreach ($campaign as $value) {
	$feed .= $value . "\r\n";
}
}
echo $feed;

The above code gives me the following error

Catchable fatal error: Object of class Campaign could not be converted to string in /home/******/public_html/tmpl/default.php on line 13

 

If I just print the array, this is how it starts out

Array ( [0] => Campaign Object ( [campaignName:private] => SimpleXMLElement Object ( [0] => aaaCopy of March 2011 Newsletter ) [id:private] => SimpleXMLElement Object ( [0] => http://api.constantcontact.com/ws/customers/******/campaigns/1105174741613 ) [link:private] => SimpleXMLElement Object ( [0] => /ws/customers/******/campaigns/1105174741613 ) [status:private] => SimpleXMLElement Object ( [0] => Draft ) [campaignDate:private] => SimpleXMLElement Object ( [0] => 2011-04-14T17:07:23.245Z ) [lastEditDate:private] => [campaignSent:private] => [campaignOpens:private] => [campaignClicks:private] => [campaignBounces:private] => [campaignForwards:private] => [campaignOptOuts:private] => [campaignSpamReports:private] => [subject:private] => [fromName:private] => [campaignType:private] => [vawp:private] => [vawpLinkText:private] => [vawpText:private] => [permissionReminder:private] => [permissionReminderText:private] => [greetingSalutation:private] => [greetingName:private] => [greetingString:private] => [orgName:private] => [orgAddr1:private] => [orgAddr2:private] => [orgAddr3:private] => [orgCity:private] => [orgState:private] => [orgInternationalState:private] => [orgCountry:private] => [orgPostalCode:private] => [incForwardEmail:private] => [forwardEmailLinkText:private] => [incSubscribeLink:private] => [subscribeLinkText:private] => [emailContentFormat:private] => [emailContent:private] => [textVersionContent:private] => [styleSheet:private] => [lists:private] => Array ( ) [fromEmailAddress:private] => [fromEmailAddressLink:private] => [replyEmailAddress:private] => [replyEmailAddressLink:private] => [archiveStatus:private] => [archiveUrl:private] => ) [1] => Campaign Object ( [campaignName:private] => SimpleXMLElement Object ( [0] => March 2011 Newsletter ) [id:private] => SimpleXMLElement Object ( [0] => http://api.constantcontact.com/ws/customers/******/campaigns/1104754710085 ) [link:private] => SimpleXMLElement Object ( [0]

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.