Constant Contact wants to help you succeed! We’re celebrating our professional service programs on the Constant Contact Community this month and you have a chance to try one of the services for free! Learn more.
I tried to integrate Constant Contact API in Drupal 8 using a custom module. In my local windows OS, it works fine but when it's tested on Linux / Mac OS I get the following error: "Error: Class 'Ctct\ConstantContact' not found" In Linux, PHP is 7.
The website encountered an unexpected error. Please try again later.
Error: Class 'Ctct\ConstantContact' not found in Drupal\constant_contact\Form\ConstantContactBlockForm->callConstantContactAPI() (line 227 of modules/custom/constant_contact/src/Form/ConstantContactBlockForm.php).
In line number 227, I have called
$ctct = new ConstantContact($APIKEY);
Thank you for your suggestion in advance.
Solved! Go to Solution.
I'm sorry to hear that you are having issues attempting to integrate Constant Contact. For further assistance in regards to this and other API's please refer to this article. If you have further questions, you can also reach out to webservices(at)constantcontact.com
Thank you @Jon_G for the reply.
I guess you for get to mention the article link as you have stated "For further assistance in regards to this and other API's please refer to this article."
I found the solution. It's actually due to the wrong path for the libraries "src/ and vendor/".
If you are working on Drupal 8, the path should be as :
require drupal_get_path('module', 'constant_contact').'/lib/src/Ctct/autoload.php'; require drupal_get_path('module', 'constant_contact').'/lib/vendor/autoload.php';
I have created a custom module to link up with Constant Contact API using php_sdk libraries. And those libraries reside under 'lib/' folder.