I found a bug in the PHP SDK and have a bug fix....
I just spent way too much time figuring this out. But I figured it out....
I was trying to add a contact with action_by and opt_in_source set to ACTION_BY_VISITOR, but it wasn't letting me. Constant Contact's servers kept saying "amp;action_by" is an invalid parameter. I'll spare you the 8 hours I spent trying to fix it by posting the instructions here. Hopefully this makes it into the official build.
In the SDK, open up BaseService.php and go to line 47. You will see this function:
The problem with this function is certain versions of PHP will return an encoded string ready to be inserted into HTML. This means all parameters are separated by & instead of a plain & symbol. This causes problems with the servers. The solution is simple. We just need to tell http_build_query to build a query with & instead of &
Re: I found a bug in the PHP SDK and have a bug fix....
Thanks for your post on this. I apologize that this caused an issue and took so much of your time to diagnose. After doing a little bit of research, it appears this is not entirely related to the PHP version you are using, but also php.ini configuration options. See http://www.php.net/manual/en/ini.core.php#ini.arg-separator.output for more details.
That beings said, I see no reason to NOT explicitly specify '&' as the separator when using http_build_query, so I will get this change into the library. Thanks again for your efforts!
Update: The following pull request was merged and contains your fix:
You can post a new message in the Community or find us on Twitter Mon-Fri 8am-8pm ET, Sat 10am-8pm ET, & Sun 10am-6pm ET. We've got real people waiting to help you out. Click below to start a conversation!