Let's get down to practice
Let's look at the requests to api.testmail.top by examples. To try to send from a request to check a deliberately false domain/email, taken from one of the most popular temporary mail services temp-mail.org, from the console
cURL request:
curl --location --request GET 'https://api.testmail.top/domain/check?data=fovah86335@990ys.com&ip=154.115.9.195' \
--header 'Authorization: Bearer XXXXXXXXXX.XXXXXXXXXX.XXXXXXXXXX'
cURL response:
{
"error": 0,
"result": false,
"message": "This domain is in Blacklist"
}
The response received "result": false
- which means that this user CANNOT be allowed to register
Now, let's try to send a request for domain/email verification using PHP. As in the previous example, there is nothing difficult, now, for example, let's send 100% GMAILtrust mail. On my own I recommend setting the CURLOPT_TIMEOUT parameter to 3 seconds, although a regular request takes a split second - this will protect your registration from crashing if the api.testmail.top server is unavailable
PHP - cURL request:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.testmail.top/domain/check?data=typicaluser@gmail.com&ip=154.115.9.195',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 3,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer XXXXXXXXXX.XXXXXXXXXX.XXXXXXXXXX'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
PHP - cURL response:
{
"error": 0,
"result": true,
"message": "This domain is in Whitelist"
}
In response, we received "result": true
- this means that this user MAY be allowed to register