@Shannon Hello, Yes, I'm using the github repository above. I've also used your github repo to retrieve my access token and successful used it by appending it to the endpoint. (For example retrieve a list of all contacts or a particular contact by email address.) I'm still not able to successfully use the API. For the sake of trouble shooting I'm trying to simplify things as much as possible: This is my config.php: <?php
$username = "MyAccount";
$accessToken = "XXX-MYACCESSTOKEN-XXX";
$apikey = "XXX-MYAPIKEY-XXX";
?> This is my index.php: <?php
session_start ();
require_once 'ConstantContact.php';
require_once 'config.php';
$ConstantContact = new ConstantContact("oauth2", $apiKey, $username, $accessToken);
$Contact = new Contact();
$Contact->emailAddress = 'ExistingUser@email.com';
$email_exists = $ConstantContact->searchContactsByEmail($Contact->emailAddress);
if($email_exists == false || $email_exists == ''){
echo 'searchContactsByEmail() returned nothing';
} else {
echo 'User is already registered';
}
?> This index.php outputs the following line: Constant Contact HTTP Request Exception: searchContactsByEmail() returned nothing I looks like the Constant Contact error comes from an exception thrown in CTCTRequest "makeRequest" method. (basically, a cUrl error.) I've output debug_backtrace() within "makeRequest" and everything appears to be okay up to that point, it's the actually cUrl that isn't working. Trying to recreate by hardcoding recreating the cUrl by itself in a separate file also doesn't work with curl_errno() outputting: "Curl error: SSL connection timeout" I've tried numerous cUrl options trying to get this to work without any luck. any ideas? Thank you. example cUrl script (outputs "SSL connection timeout") if (!function_exists('curl_init')){
die('cURL is not installed!');
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.constantcontact.com/ws/customers/MyAccount/contacts?email=KnownUser@email.com");
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 20);
//curl_setopt($curl, CURLOPT_HTTPGET, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Authorization: Bearer XXX-MYACCESSTOKEN-XXX, ContentType: application/atom+xml, Accept: application/atom+xml"));
$output = curl_exec($curl);
if($output === false){
echo 'Curl error: ' . curl_error($curl);
$info = curl_getinfo($curl);
echo '<pre>';
print_r($info);
echo '</pre>';
} else {
echo $output;
}
curl_close($curl);
... View more