-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathistempmail.php
56 lines (41 loc) · 1.08 KB
/
istempmail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
if (!function_exists("curl_init")) {
throw new Exception("IsTempMail API needs the CURL PHP extension.");
}
class IsTempMail
{
private $token;
const API_CHECK = 'https://www.istempmail.com/api/check/';
function __construct($token)
{
$this->token = $token;
}
public function getToken()
{
return $this->token;
}
public function setToken($token)
{
$this->token = $token;
return $this;
}
public function isDea($domain)
{
$url = self::API_CHECK . $this->getToken() . '/' . $domain;
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 60,
));
$response = curl_exec($ch);
$jsonObject = @json_decode($response);
if(!$jsonObject) {
return false;
}
if(isset($jsonObject->error)) {
throw new Exception($jsonObject->error_description);
}
return $jsonObject->blocked;
}
}