工具

芝麻通工具箱php原生开发域名whois查询总结

芝麻通工具箱域名whois查询php原生开发总结

芝麻通工具箱php原生开发域名whois查询总结

为了方便大家查询各种信息,芝麻通近期上线的工具箱频道,旨在为大家提供各种场景的查询服务。

体验地址:whois.zhimatong.com/

芝麻通域名whois查询功能已实现如下功能:

  1. 域名以https或者http开头查询时,自动简化去掉,只显示主域名;
  2. 域名以www或其他子域名开头查询时,自动简化,只显示主域名;
  3. 直接访问网址时,同样按照上述规则过滤;

具体代码如下:

if(substr(strtolower($domain), 0, 8) == "https://"){
	$Redirect = 1 ;
	$domain = substr($domain,8); // 去除 http://
}
if(substr(strtolower($domain), 0, 7) == "http://"){
	$Redirect = 1 ;
	$domain = substr($domain, 7); // 去除 http://
}
$domain = preg_replace('/\s/', '',$domain);
$a = explode(".",$domain);
$domainLenth = sizeof($a)-1;//获取域名中有几个逗号.
if($domainLenth > 1 &&(!strpos($domain,'.com.cn') || !strpos($domain,'.org.cn') || !strpos($domain,'.net.cn') || !strpos($domain,'.edu.cn')  || !strpos($domain,'.gov.cn'))){
	$Redirect = 1 ;
	$domain = $a[($domainLenth-1)].".".$a[$domainLenth]; //去除子域名
}
$domain = str_replace('/', '', $domain);
if ($Redirect == 1) {
	header("Location:https://tool.zhimatong.com/whois/".$domain);
	exit();
}

下一步,我们将优化查询结果显示效果,不断提升用户体验。

本文属原创,转载请注明原文:http://www.zhimatong.com/jiaocheng/267.html

为保证教程的实用性及扩大知识面覆盖,如果您有相似问题而未解决,可联系在线客服免费技术支持。

内容有用

联系
顾问

在线
客服
购物车
账号登录

没有账号?立即注册

忘记密码

登录即同意用户协议没有账号? 立即注册
账号注册
我已阅读并同意用户协议
立即注册
注册即同意用户协议已有账号? 立即登录
找回密码

操作步骤:邮箱验证->设置新密码

注册即同意用户协议已有账号? 立即登录