-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.class.php
44 lines (36 loc) · 974 Bytes
/
email.class.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
<?php
class Constans
{
const api_endpoint = 'https://www.renirails.id';
const api_password = 'YOUR_ACCESS_KEY';
}
class Request
{
public function CurlGet($url, $headers){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}
class Email{
protected $email;
public function __construct($email = null){
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
exit("Email Format Not Valid");
}
$this->email = $email;
}
public function verify(){
$headers = array(
'request_key: ' . Constans::api_password,
);
return Request::CurlGet(Constans::api_endpoint . "/api/v2.0/isEmailReal/" . $this->email, $headers);
}
}