'; $check_html="
请输入网址:http://
"; class seo_Check{ public $url; function __construct($url){ $this->url=$url; } function show_seo(){ $this->check_url(); $this->get_content(); } function check_url(){ $zurl=$this->url; if(!empty($zurl)){ $pattern="/^(http\\:\\/\\/)?(www)?\\.([0-9a-z]+)\\.(com|cn|net|com\\.cn)$/i"; if(preg_match($pattern,$zurl,$newurl)){ if(!empty($newurl[1])){ $zurl=trim($newurl[1].".".$newurl[2].".".$newurl[3].".".$newurl[4]); //$this->url=$zurl; } } else { die("网址不合法!"); } } } //get_content() function get_content(){ $strem="http://seo.chinaz.com/?host=".$this->url; //echo $strem; $contents=file_get_contents($strem); // file_get_contents获取内容 if (!preg_match("",$contents)){ // 暂时这样测试匹配成功与否 die("内容失效"); } $contents=str_replace("\\n",'',$contents); $contents=str_replace("/template/default/images",'http://seo.chinaz.com/template/default/images',$contents); preg_match("/\\(.*?)\\<\\/table\\>/i",$contents,$newcode); $_infohtml="
".$newcode[2]."
"; echo $_infohtml; } } if ($_POST['ck_tj']){ if(!empty($_POST['ck_url'])){ $ck_url=$_POST['ck_url']; $show_seo1=new seo_Check($ck_url); $show_seo1->show_seo(); } }else { $ck_url=""; echo $check_html; } //echo $show_seo1->cur_html; ?> //该片段来自于http://yuncode.net