I'm presently using this code for a client, and wanted to check to see if any changes are needed to support the new API requirements recently sent out by Constant Contact (Basic Authentication over HTTPS). I'm not entirely sure if I'm understanding the changes, and if the code above uses the REST API that the e-mail referred to. Any help is appreciated.
Okay, so just to make sure, the only change is:
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
As well as making the PHP script be called over https, instead of http, correct?
Provided your Apache (or whichever platform you're running) already has SSL Modules installed and configured, this is all you need to do. If you do not, that is actually something you will want to go to your host or vendor for support with as it is beyond the scope of the Constant Contact API.
For anyone else needing to correct their code to operate over BASIC authentication, you need to also change this line:
$request ="http://api.constantcontact.com/ws/customers/" . $UN . "/contacts";
$request ="https://api.constantcontact.com/ws/customers/" . $UN . "/contacts";
Notice the request is now operating over https. I guess Dave missed that one..