The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

Constant contact API not working live

Highlighted
Occasional Contributor

Constant contact API not working live

I have a constant contact script which works perfectly in my localhost. But it doesnot work on the live server.

 

My php version is 7.0

Both API keys and access token available.

 

Here is the sample code:

 

echo '1';

require_once('vendor/constantcontact/constantcontact/src/Ctct/autoload.php');
require 'vendor/autoload.php';

echo '2';

use GuzzleHttp\Client;

use Ctct\ConstantContact;
use Ctct\Components\Contacts\Contact;
use Ctct\Components\Contacts\ContactList;
use Ctct\Components\Contacts\EmailAddress;
use Ctct\Exception\CtctException;

echo '3';

define('API_KEY', 'my_api_key');
define('ACCESS_TOKEN', 'my_access_token');

echo '4';

$cc = new ConstantContact(API_KEY);

echo '5';

 

I used echos to check where my code breaks. It breaks on 5. It prints till 4 and 5 doesn't get printed.

 

Live server shows me this error: Class 'GuzzleHttp\Client' not found

 

Whereas in localhost, It works perfectly.

 

What am I missing??

 

Some help would be appreciated.. Thanks

4 REPLIES 4
Highlighted
Occasional Contributor

GuzzleHttp\Client not found

require_once('vendor/constantcontact/constantcontact/src/Ctct/autoload.php');
require 'vendor/autoload.php';


use GuzzleHttp\Client;

use Ctct\ConstantContact;
use Ctct\Components\Contacts\Contact;
use Ctct\Components\Contacts\ContactList;
use Ctct\Components\Contacts\EmailAddress;
use Ctct\Exception\CtctException;


define('API_KEY', 'my_api_key');
define('ACCESS_TOKEN', 'my_access_token');

$cc = new ConstantContact(API_KEY);

 

This script works on my local machine. But not on server. Anyone got any ideas??

 

Thanks

Highlighted
Moderator

Re: Constant contact API not working live

Hello,

 

Thank you for reaching out to the API Support team here at Constant Contact.

 

If it works on your localhost but not live, then it seems like the problem could be something on your server.  Did you install our SDK using Composer, or manually download and extract our zip? 


Sincerely,
David B.
API Support Specialist

Highlighted
Occasional Contributor

Re: Constant contact API not working live

I installed constant contact SDK using composer in the local machine and uploaded the zip and extract it..

 

Live server shows me this error: Class 'GuzzleHttp\Client' not found

Highlighted
Moderator

Re: Constant contact API not working live

Hello,

 

There are a lot of reasons that this error can appear. At its root, it's saying that Guzzle may not be installed. At least not where it's trying to find it. There may be an older version installed somewhere on your server, composer may not be installed, or the vendor.zip may not be extracted, etc.

 

In order to troubleshoot further I'd like to take a look at the zip file you uploaded and extracted. Could you send that in an email to webservices@constantcontact.com? 

 

Sincerely,
David B.
API Support Engineer

Developer Portal

View API documentation, code samples, get your API key.

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured