

欢迎光临
以下代码可以从URL中获得域名 例如:http://souzz.net/html/database/ORACLE/69613.html 得到souzz.net function get_domain($url){ $pattern = "/[w-]+.(com|net|org|gov|cc|biz|info|cn)(.(cn|hk))*/"; preg_match($pattern, $url, $matches); if(count($matches) > 0) { return $matches[0]; }else{ $rs = parse_url($url); $main_url = $rs["host"]; if(!strcmp(long2ip(sprintf("%u",ip2long($main_url))),$main_url)) { return $main_url; }else{ $arr = explode(".",$main_url); $count=count($arr); $endArr = array("com","net","org","3322");//com.cn net.cn 等情况 if (in_array($arr[$count-2],$endArr)){ $domain = $arr[$count-3].".".$arr[$count-2].".".$arr[$count-1]; }else{ $domain = $arr[…阅读全文>>
所属分类:学习笔记评论(0)|阅读 (172)|分享(0)
很遗憾,您访问的工作室暂未添加作品。