Add Contact Sample Script Error

Occasional Participant

Add Contact Sample Script Error

I am using the Add contact sample script. After pressing the Add contact button it is showing the following error.

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/kshitijc/public_html/Contact.php on line 41

Can anybody help please?

Before we try to trouble shoot this any, can we confirm two things? Have you made any changes to the sample script? Are you using PHP 5.0+ or are you using PHP 4.0?
Dave Berard
Senior Product Manager, Constant Contact
Occasional Participant

1) We are using PHP 5.2.6

2) Yes changes have been made to the sample script only in AddAContact.php in the following fields as told in the Readme file :
a) username
b) password
c) API key
d) contact list name
and e) the url of our home page.

Shouldn't these be done? Please suggest.
Regular Participant

come on, i have same problem, how solve it???

There are two common reasons this happens:


1. The version of PHP you're running doesn't support the code in your PHP file.  This could happen because you're using an older version that doesn't support newer syntax or a newer version and including depricated/removed syntax. 

2. More commonly, you are using an FTP file that is causing a BOM marker to be injected in your PHP files which causes the PHP interpreter to fail reading your PHP files.  If you are running into option 2, the easiest solution is to change the upload file type from ASCII to Binary.  By telling the FTP app to upload the files as binary, they will not modify the files to add a BOM at the beginning of the file.

Dave Berard
Senior Product Manager, Constant Contact
Developer Portal

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

Visit Page