Validate.php
1.2 KB
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
<?php
namespace App\Helper;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
/**
* Class Validate
* @package App\Helper
* @author zbj
* @date 2025/2/27
*/
class Validate
{
/**
* 邮箱有效性
* @param $email
* @return bool
* @author zbj
* @date 2025/2/27
*/
public static function email($email)
{
try {
$res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $email]);
$res = Arr::s2a($res);
$status = $res['data']['status'] ?? 0;
} catch (\Exception | GuzzleException $e) {
$status = 0;
}
return !($status == 2);
}
/**
* 邮箱有效性
* @param $email
* @return bool
* @author zbj
* @date 2025/2/27
*/
public static function phone($email)
{
try {
$res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $email]);
$res = Arr::s2a($res);
$status = $res['data']['valid_status'] ?? 0;
} catch (\Exception | GuzzleException $e) {
$status = 0;
}
return !($status == 2);
}
}