PHP code example of classy-org / constantcontact-php-client
1. Go to this page and download the library: Download classy-org/constantcontact-php-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
classy-org / constantcontact-php-client example snippets
try {
$response = $client->request('POST', 'path/to/route', ['body' => ['check' => 1]]);
} catch (Exception $e) {
if ($e instanceof \GuzzleHttp\Exception\ConnectException) {
// there was a networking error
}
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
// Mailchimp API returned a 4xx response.
$httpStatusCode = $e->getCode();
if ($httpStatusCode == 404) {
// resource doesn't exist
}
if ($httpStatusCode == 401) {
// you're unauthorized (api key must be invalid)
}
if ($httpStatusCode == 403) {
// you're not allowed to request this endpoint
}
if ($httpStatusCode == 400) {
// body payload is invalid
}
if (...) {
//
}
$bodyResponse = $e->getResponse()->getBody()->getContents();
}
if ($e instanceof \GuzzleHttp\Exception\ServerException) {
// ConstantContact returned a 5xx response, which means they experience technical difficulties.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.