Reply
New Member
danfishbach
Posts: 2
Registered: ‎05-26-2010

Warning: Cannot modify header information - headers already sent...

Using the PHP sample form when trying to add/edit a contact, I get this error:


 


Warning: Cannot modify header information - headers already sent by (output started at /hermes/bosweb/web140/b1402/ipw.odysseyt/public_html/contactsystem/cc_class.php:1) in /hermes/bosweb/web140/b1402/ipw.odysseyt/public_html/contactsystem/edit_contact_step1.php on line 13


 


Any ideas?


 


Thanks!

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

PHP cannot modify header information

I've not been able to replicate the error that you are having while trying to add or edit a contact using edit_contact_step1.php. If you have not made any modifications the php sample pack, make sure there is no white space outside of the php start and end tags. A blank line before the <?php start tag may be processed as an echo statement of a blank line when parsed by PHP. This is a common cause of this issue.


 


If you have made some modifications to the sample form, if you could please send your edit_contact_step1.ph pand cc_class.php to our webservices support team, and let me know at exactly what point you are receiving the error. I would be happy to take a look.

David J

New Member
webbersites
Posts: 2
Registered: ‎06-25-2010

bug

 Same problem here


out of the box when you go to the Add or Edit Contact page and enter an email:


Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/a/n/randyband/html/cc_api/cc_class.php:1) in/home/content/r/a/n/randyband/html/cc_api/edit_contact_step1.php on line 10

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

Re: bug

This issue can often be caused by uploading the files using the ASCII transfer type. I was able to replicate this issue on my server by uploading using that method. If you change the transfer type to binary this should stop that error message from occurring. If this does not resolve your issue please let me know and  I will be happy to continue to troubleshoot.

David J

New Member
webbersites
Posts: 2
Registered: ‎06-25-2010

Binary Upload

I uploaded as Binary and now I get more errors.


 


 Warning: Invalid argument supplied for foreach() in /home/content/r/a/n/randyband/html/cc_api/cc_class.php on line 266




Warning: Invalid argument supplied for foreach() in /home/content/r/a/n/randyband/html/cc_api/cc_class.php on line 283



Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/a/n/randyband/html/cc_api/cc_class.php:1) in/home/content/r/a/n/randyband/html/cc_api/edit_contact_step1.php on line 10

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

Re: Binary Upload

I am able to replicate the exact same error messages you are receiving by not supplying a username, password, and apiKey in the cc_class.php file.


Warning: Invalid argument supplied for foreach() in ..../html/cc_api/cc_class.php on line 266


Warning: Invalid argument supplied for foreach() in ..../html/cc_api/cc_class.php on line 283


You would need to modify $login, $password, and $apiKey with your valid login information. These values should be on lines 13, 14, and 15.


Regarding the "Warning: Cannot modify header information" message that you are getting, this is as a result of something being printed to the screen before this header is being sent on line 10. The most common cause is uploading using the ASCII transfer type as opposed to Binary. If you are sure that you have uploaded using the Binary transfer type, please let me know which program you are using to upload your files, as well as provide a link to the page where you are seeing this error message. If you would prefer to keep this information private, please feel free to send an email to our webservices support team and I will be glad to take a look.

David J

New Member
testshoot
Posts: 1
Registered: ‎07-23-2010

Same error

Shows a big array, then dumps the following error. I changed to binary transfer method, exact same error as ascii. I use SmartFTP 64bit latest build


cc_class.php:116

signup.php on line 59


 


edit: i am cursed with 1and1 hosting

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

Re: Same error

Which error messages are you receiving on those lines?


 


Warning: Invalid argument supplied for foreach() in ....?


Warning: Cannot modify header information....?


 


Or is there another one that you are getting?


 


Also, are you using the CCSFG or our Sample PHP forms? Each of these use a cc_class.php but neither use a 'signup.php' file. Depending on which errors you are receiving is going to result in some different troubleshooting steps.

David J

New Member
chriseverson
Posts: 1
Registered: ‎01-28-2011

Error Replication

I was able to replicate this error using correct un/pw but an incorrect API key. Double-check your API key would be my suggestion.  

CTCT Employee
David_J
Posts: 510
Registered: ‎06-04-2009

Re: Error Replication

My guess would be that the curl_debug setting is turned on at the top of cc_class.php which would then use the following code if an error had occured in connecting with Constant Contact.


$emessage = curl_exec($ch);          

           if ($this->curl_debug) {   echo $error = curl_error($ch);   }

           curl_close($ch);

This would cause the curl_error message to be displayed, which would throw an error when trying to redirect to any page because the curl error had already been outputted on the page. Authentication errors with the username, password, or API Key would all cause this.


This same error message would occur if any text had been displayed on the screen before redirecting.

David J