PHP

How to use Email Warrant with PHP.

Below is an example of how to call the Email Warrant API using PHP:

<?php
// get cURL resource
$ch = curl_init();
// set url
curl_setopt(
$ch,
CURLOPT_URL,
'https://api.emailwarrant.com/v1/verify.php?userID=<USERID>&apiKey=<APIKEY>&domain=<DOMAIN>'
);
// set method
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
// return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// send the request and save response to $response
$response = curl_exec($ch);
// stop if fails
if (!$response) {
die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
}
echo 'HTTP Status Code: ' . curl_getinfo($ch, CURLINFO_HTTP_CODE) . PHP_EOL;
echo 'Response Body: ' . $response . PHP_EOL;
// close curl resource to free up system resources
curl_close($ch);
?>

If you any issues getting set up with Email Warrant, please contact support@emailwarrant.com. We are always happy to help!