PHP example for get contacts v3 is not working

Occasional Participant

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..

 

0 REPLIES 0
Developer Portal

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

Visit Page