1. Go to this page and download the library: Download nexiom/connect-php 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/ */
nexiom / connect-php example snippets
use Nexiom\Connect\NexiomConnect;
$nexiomConnect = new NexiomConnect('nc_your_api_key_here');
// Optional custom host:
// $nexiomConnect = new NexiomConnect(
// apiKey: 'nc_...',
// baseUrl: 'https://api-connect.nxiom.com/api',
// );
$page = $nexiomConnect->emails->list(['status' => 'bounced', 'limit' => 50]);
foreach ($page['items'] as $delivery) {
echo $delivery['id'], ' ', $delivery['recipient'], ' ', $delivery['status'], PHP_EOL;
}
// Next page: pass $page['nextCursor'] as 'cursor'; it is null on the last page.
$page = $nexiomConnect->emails->suppressions->list(['search' => 'example.com', 'limit' => 50]);
foreach ($page['items'] as $suppression) {
echo $suppression['email'], ' ', $suppression['reason'], PHP_EOL;
}
// Next page: pass $page['nextCursor'] as 'cursor' while $page['hasMore'] is true.
$domain = $nexiomConnect->domains->create(['domain' => 'mail.example.com']);
foreach ($domain['dns_records'] as $record) {
echo $record['record_type'], ' ', $record['name'], ' ', $record['value'], PHP_EOL;
}
// After publishing the records with your DNS provider:
$domain = $nexiomConnect->domains->verify($domain['id']);
echo $domain['status'];
use Nexiom\Connect\Exceptions\ErrorKind;
use Nexiom\Connect\Exceptions\NexiomException;
try {
$nexiomConnect->contacts->get('ct_123');
} catch (NexiomException $error) {
if ($error->kind === ErrorKind::Api && $error->status === 404) {
// The contact does not exist.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.