input('content','0'); $contenttype=v::ip()->validate($content); if(!$contenttype){ $contenttype=v::domain(false)->validate($content); if(!$contenttype){ return '请输入合法的IP或域名'; }else{ $contenttype='domain'; $msg['DNS']=dns_get_record("$content",DNS_ANY); $whois = Http::get('https://api.devopsclub.cn/api/whoisquery?type=json&standard=true', ['domain' => "$content"]); $whois=json_decode($whois); if($whois->code) $msg['Whois']=array; } }else{ $contenttype='ip'; $msg['Host']=gethostbyaddr("$content"); $reader = new Reader(base_path().'/geoip/GeoLite2-City/GeoLite2-City.mmdb'); $locate=$reader->city($content); $country=$locate->raw['country']['names']['zh-CN']; if(array_key_exists("city",$locate->raw)){ $city=$locate->raw['city']['names']['zh-CN']; }else{ $city=$country; } $msg['Location']="$city/$country"; $msg['Network']=$locate->traits->network; $asnreader= new Reader(base_path().'/geoip/GeoLite2-ASN/GeoLite2-ASN.mmdb'); $asn=$asnreader->Asn("$content"); $asnnumber=$asn->autonomousSystemNumber; $msg['ASN']="AS:".$asnnumber.'/'.$asn->autonomousSystemOrganization.''; } View::assign('msg', $msg); return view('print'); } }