网站认证源码,北京建设行政主管部门官方网站,网站开发人员需要什么要求,广州建设工程交易中心南沙交易部直接使用TCP协议向WHOIS服务器的43端口发送查询请求即可返回WHOIS信息。 一些国际域名(.COM/.NET/.CC等)需要继续向各注册商的WHOIS服务服务发送查询请求来获取详细信息。 大部分New gTLD来说#xff0c;服务器是“whois.nic.[后缀]”#xff0c;例如.red的WHOIS服务器为whoi…直接使用TCP协议向WHOIS服务器的43端口发送查询请求即可返回WHOIS信息。 一些国际域名(.COM/.NET/.CC等)需要继续向各注册商的WHOIS服务服务发送查询请求来获取详细信息。 大部分New gTLD来说服务器是“whois.nic.[后缀]”例如.red的WHOIS服务器为whois.nic.red。
WHOIS服务器列表https://whereiswhois.com/
PHP示例
$domain baidu.com;$fs fsockopen(whois.verisign-grs.com, 43, $errno, $errstr);
if(!$fs){write_line(sprintf(%s: %s, $errno, $errstr));return;
}try
{fwrite($fs, $domain . \r\n);$whois file_read_all_bytes($fs);write_line($whois);
}
catch(\Exception $ex)
{write_line($ex-getMessage());
}
finally{fclose($fs);
}function file_read_all_bytes($fs){$response ;while(!feof($fs)){$response . fread($fs, 4096);}return $response;
}function write_line($message) : void {echo $message . \r\n;
}c#示例
string domain baidu.com;Socket client new(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);try
{client.Connect(whois.verisign-grs.com, 43);byte[] request Encoding.ASCII.GetBytes(domain \r\n);using NetworkStream stream new NetworkStream(client, true);stream.Write(request, 0, request.Length);using MemoryStream output new();stream.CopyTo(output);byte[] response output.ToArray();Console.WriteLine(Encoding.UTF8.GetString(response));
}
catch (Exception e)
{Console.WriteLine(e.ToString());
}