php域名查询代码,域名查询 php页面

<?php header("content-type:text/html;charset=utf-8"); header("cache-control:no-cache"); $domain = htmlspecialchars(trim($_REQUEST['domain']));                 //取出不能识别的字符 $str= $_REQUEST['str'];                                                //后缀信息 if( !$domain ){     echo '请输入要查询的域名,如:tjtty';     exit; } if( !$str ){     echo '请输入域名后缀,如.com';     exit; } $arr=explode(':',$str);                                //将获得的数据分割成数组 $num=count($arr);                                      //获取数组的数目                                 for($i=0;$i<$num;$i++){ $hou.=$arr[$i].","; }          //循环获得数组 $info=substr($hou,0,-2);                               // .com,.net,.cn,.com.cn,.net.cn $info1=str_replace(",.",",",$info);                    //用,替换,. $info2=substr($info1,1);                               //字符串的提取        com,cn,net  格式 $dtime=date("YmdHi",time());                                        //传给接口的时间 $pwd= md5('******'.'*******'. date("YmdHi",time()));      //传给接口的加密数据                      $domain_api = "http://api.dmctr.cn/trans_api/api.php?command=Dmcheck&vtime=".$dtime."&checksum=".$pwd."&charset=utf-8&sld=".$domain."&tld=".$info2; $contents= file_get_contents($domain_api); //$xml = simplexml_load_string(trim($contents));        //使用该方法出错  应该是xml文档加载出错 $pattern='#(.*)#iUs'; preg_match_all($pattern,$contents,$matches); $xml=$matches[1]; $xml_num=count($xml); function  get_info($xml){        //$xml为内容    //获取域名的名字     $pattern02='#(.*)#iUs';     preg_match_all($pattern02,$xml,$matches02);     $xml_name=($matches02[1][0]);     //获取返回的编码     $pattern01='#(.*)#iUs';     preg_match_all($pattern01,$xml,$matches01);     $xml_code=($matches01[1][0]);         if($xml_code==-1){         return  "验证超时";      }else if($xml_code==0){         return  "".$xml_name."对不起,已注册
";      }else if($xml_code==1){   //  可根据session确定用户是否登录         return  "".$xml_name."恭喜,可注册立即注册
";      } } for($i=0;$i //保护隐私  略作修改     灵感来自:http://www.5idev.com/p-php_domain_ajax.shtml

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值