I have a windows hosting server which my client hosts her php based website on. I am trying to use the below code to insert a contact into the constant contact account. The windows server does have curl installed when I check if curl is installed via doing a var_dump(curl_version()); I get the below which shows me curl is installed array(9) {
["version_number"]=>
int(464128)
["age"]=>
int(3)
["features"]=>
int(2716)
["ssl_version_number"]=>
int(0)
["version"]=>
string(6) "7.21.0"
["host"]=>
string(13) "i386-pc-win32"
["ssl_version"]=>
string(14) "OpenSSL/0.9.8q"
["libz_version"]=>
string(5) "1.2.3"
["protocols"]=>
array(16) {
[0]=>
string(4) "dict"
[1]=>
string(4) "file"
[2]=>
string(3) "ftp"
[3]=>
string(4) "ftps"
[4]=>
string(4) "http"
[5]=>
string(5) "https"
[6]=>
string(4) "imap"
[7]=>
string(5) "imaps"
[8]=>
string(4) "ldap"
[9]=>
string(4) "pop3"
[10]=>
string(5) "pop3s"
[11]=>
string(4) "rtsp"
[12]=>
string(4) "smtp"
[13]=>
string(5) "smtps"
[14]=>
string(6) "telnet"
[15]=>
string(4) "tftp"
}
} The php code I am using which I know works on a LAMP server but can not figure out why its not working on my windows server with php installed is // Instantiate CC_Contact class $date = date("Y-m-d\TH:i:s"); /////////// REGISTER EMAIL WITH CONSTANT CONTACT /////////////////// $UN = "******"; $PW = "******"; $Key = "******"; $entry = $theXml = <<<THE__XML <entry xmlns="http://www.w3.org/2005/Atom"> <title type="text"></title> <updated>$date</updated> <author></author> <id>data:,none</id> <summary type="text">Contact</summary> <content type="application/vnd.ctct+xml"> <Contact xmlns="http://ws.constantcontact.com/ns/1.0/"> <EmailAddress>$emailaddr</EmailAddress> <FirstName>$firstname</FirstName> <LastName>$lastname</LastName> <CustomField6>$cname</CustomField6> <CustomField1>$info</CustomField1> <OptInSource>ACTION_BY_CUSTOMER</OptInSource> <ContactLists> <ContactList id="http://api.constantcontact.com/ws/customers/********/lists/**" /> </ContactLists> </Contact> </content> </entry> THE__XML; // Initialize the cURL session $request ="https://api.constantcontact.com/ws/customers/*******/contacts"; $session = curl_init($request); // Set up digest authentication $userNamePassword = $Key . '%' . $UN . ':' . $PW ; // Set cURL options curl_setopt($session, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($session, CURLOPT_USERPWD, $userNamePassword); 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, false); // Do not return headers curl_setopt($session, CURLOPT_RETURNTRANSFER, 0); // If you set this to 0, it will take you to a page with the http response // Execute cURL session and close it $response = curl_exec($session); curl_close($session); //End adding contact to constant contact I am hoping someone will have a suggestion for me. Again I know php is working because I have a website written in php that works fine thanks
... View more