Saved,由于原有whoisAPI失效,改用WHOIS命令查询,速度更快,但是需要安装whois命令,RHEL下yum install whois即可
This commit is contained in:
+17
-14
@@ -11,12 +11,11 @@ use yzh52521\EasyHttp\Http;
|
||||
use yzh52521\EasyHttp\Response;
|
||||
use yzh52521\EasyHttp\RequestException;
|
||||
|
||||
|
||||
class api
|
||||
{
|
||||
public function search(Request $request)
|
||||
{
|
||||
$content=$request->input('content','0');
|
||||
$content=trim($request->input('content','0'));
|
||||
$contenttype=v::ip()->validate($content);
|
||||
if(!$contenttype){
|
||||
$contenttype=v::domain(false)->validate($content);
|
||||
@@ -25,20 +24,23 @@ class api
|
||||
}else{
|
||||
$contenttype='domain';
|
||||
$msg['DNS']=dns_get_record("$content",DNS_ANY);
|
||||
$msg['IP']=gethostbyname("$content");
|
||||
exec("whois $content",$msg['WHOIS']);
|
||||
/**
|
||||
$whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"])->body();
|
||||
$whois=json_decode($whois);
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $whois->data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
if($whois->code !=0){
|
||||
$msg['Whois']='Whois查询失败';
|
||||
};
|
||||
if($whois->data->status !=0){
|
||||
$msg['Whois']='Whois查询出错,请稍后重试';
|
||||
};
|
||||
if($whois->data->status ==2 || $whois->data->status ==3 ){
|
||||
$msg['Whois']='该域名未注册或该后缀暂不支持查询';
|
||||
};
|
||||
if($whois->code == 0 && $whois->data->status == 0){
|
||||
$msg['Whois']=$whois->data->data;
|
||||
}
|
||||
$safe = Http::get('https://api.devopsclub.cn/api/dcheck', ['url' => "$content"])->body();
|
||||
$safe=json_decode($safe);
|
||||
if($safe->code == 0){
|
||||
@@ -46,6 +48,7 @@ class api
|
||||
$msg['Wx-Safe']=$safe->data->wx;
|
||||
$msg['QQ-Safe']=$safe->data->qq;
|
||||
}
|
||||
**/
|
||||
}
|
||||
}else{
|
||||
$contenttype='ip';
|
||||
|
||||
Reference in New Issue
Block a user