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.

PHP example for get contacts v3 is not working

Highlighted
Occasional Contributor

PHP example for get contacts v3 is not working

PHP example to get contacts is not working:

$request = new HttpRequest();
$request->setUrl('https://api.cc.email/v3/contacts/{contact_id}');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
  'include' => 'street_addresses'
));

$request->setHeaders(array(
  'Cache-Control' => 'no-cache',
  'Authorization' => 'Bearer {access_token}',
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

Fatal error: Uncaught Error: Class 'HttpRequest' not found

To rectify it I tried:

Downloaded php_http.dll ,

Put the dll in D:\Xampp\php\ext , 

add extension = php_http.dll in php.ini and restart the system.

But same error is shown.

 

NB: I tired with php curl and using curl  it is working..

 

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