We all started somewhere! Share your experience on the Get Advice: Let's Get Started Sweepstakes thread and be entered to win a $100 credit on your Constant Contact account.

Constant contact API not working live

ManikRatnaS
Regular Participant

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
ManikRatnaS
Regular Participant

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

David_B.
Moderator

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

ManikRatnaS
Regular Participant

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

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