I tried outputting the curl results with curl_getinfo and found out that I'm receiving a http_code of 409, which is indicated to be "Conflict." Can I post or send info to help diagnose this problem?
... View more
I had the same problem earlier, then went to the php docs and found that the variable in the statement curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0); must be the resource that was created with the curl_init call. In a previous post, the instructions said to use $ch, not $session. I changed to $session and that problem went away. Now I just have a error trying to connect to the server. I'm using Network Solutions for this client (their choice, not mine) and the curl version is libcurl/7.15.1 OpenSSL/0.9.8f zlib/1.2.3 . Any suggestions?
Here's the code for the connection:
$request = "https://api.constantcontact.com/ws/customers/".CC_USERNAME."/contacts";
$session = curl_init($request);
// Set up Basic authentication - username and password.
$userNamePassword = CC_APIKEY."%".CC_USERNAME.":".CC_PASSWORD;
curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($session, CURLOPT_USERPWD, $userNamePassword);
curl_setopt($session, CURLOPT_FOLLOWLOCATION ,1);
curl_setopt($session, CURLOPT_POST, 1);
curl_setopt($session, CURLOPT_POSTFIELDS , $entry);
curl_setopt($session, CURLOPT_HTTPHEADER, Array("Content-Type:application/atom+xml"));
curl_setopt($session, CURLOPT_HEADER, 0); // Do not return headers
curl_setopt($session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($session, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($session);
... View more