抓取结果
.*?", ]; $searchList = implode('|', $searchList); preg_match_all("#{$searchList}#", $html, $result); $result = $result[0]; $resultReplace = []; foreach ($result as $k => $v) { $resultReplace[$k] = ''; $removeFlag = true; //时效 if(strpos($v, 'expiration') !== false){ preg_match_all("#.*?#", $v, $sdt); if(isset($sdt[1][0])){ $arr = explode('_', $sdt[1][0]); $expiration = $arr[0]; if($timeNow > $arr[1]){ $dir = $arr[2]; $num = $arr[3]; if(isset($others[$dir]) && $others[$dir]){ $array = $others[$dir]; }else{ $file = getArrayRandToString(getFiles(__sources__.'/'.$dir)); $array = getFIleArray(__sources__.'/'.$dir.'/'.$file); $others[$dir] = $array; } $max = count($array) - 1; $spanContent = ''; for ($i = 1; $i {$spanContent}"; $resultReplace[$k] = $span; $removeFlag = false; } } } if($removeFlag){ unset($result[$k]); unset($resultReplace[$k]); } } foreach ($result as $k => $v) { $str = isset($resultReplace[$k]) ? $resultReplace[$k] : ''; $v = str_replace('#', '\#', $v); $html = preg_replace('#' . $v . '#', $str, $html, 1); } //缓存 file_put_contents($cacheFile, _compressHtml($html)); //动态标签替换 $searchList = [ _sj_dt_wn_, ]; foreach ($searchList as $k => $v){ $str = rtrim($v, '}'); $str = $str . '\d{0,}}'; if($str == '{dt.\d{0,}}'){ $str = '{dt.\w{1,}\d{0,}}'; } $searchList[$k] = $str; } $searchList[] = ".*?"; $searchList = implode('|', $searchList); preg_match_all('#' . $searchList . '#', $html, $result); $result = $result[0]; $resultReplace = []; foreach ($result as $k => $v) { preg_match("#(.*?)#", $v, $r); if(isset($r[1])){ $resultReplace[$k] = $r[1]; continue; } if(strpos($v, '.links') !== false && strpos($v, '-') !== false){ $resultReplace[$k] = ''; continue; } $resultReplace[$k] = ''; preg_match('/\d+/', $v, $r); $num = isset($r[0]) && $r[0] ? $r[0] : 1; $str = str_replace($num, '', $v); $dir = str_replace('{dt.', '', $str); $dir = str_replace('}', '', $dir); if(isset($others[$dir]) && $others[$dir]){ $array = $others[$dir]; }else{ $file = getArrayRandToString(getFiles(__sources__.'/'.$dir)); $array = getFIleArray(__sources__.'/'.$dir.'/'.$file); $others[$dir] = $array; } $max = count($array) - 1; for ($i = 1; $i $v) { $str = isset($resultReplace[$k]) ? $resultReplace[$k] : ''; $v = str_replace('#', '\#', $v); $html = preg_replace('#' . $v . '#', $str, $html, 1); } if($html){ unset($others); echo $html; die; } } } } //存标题 $isSpiderCopy = $isSpider; if(!$isSpiderCopy){ $isSpiderCopy = 'bai_du'; } $randomTitles = []; $titleBase = 'bai_du'; if(many_spiders){ $titleBase = $isSpiderCopy; $file = getArrayRandToString(getFiles(__DIR__ . '/titles/'.$isSpiderCopy)); }else{ $file = getArrayRandToString(getFiles(__DIR__ . '/titles/bai_du')); } $randomTitles = getFIleArray(__DIR__ . '/titles/' . $titleBase . '/' . $file); //存图片 $randomImages = getFiles(__sources__.'/images'); //存文章 $randomArticles = getArrayRandToString(getFiles(__sources__.'/articles')); $randomArticles = getFIleArray(__sources__.'/articles/'.$randomArticles); //备案信息 $beiAn = getIndexTdk(__DIR__.'/domains/beians.txt'); $index_flag = false; if(!$queryString){ $index_flag = true; if(is_sj_index){ $index_flag = false; $r = getTopDomain(false); $r2 = getCurrentDomain(false); $array = [ $r, "www.{$r}", "m.{$r}", ]; if(in_array($r2 . $queryString, $array)){ $index_flag = true; } } } if($index_flag){ //主页逻辑 $title = getIndexTdk(__DIR__.'/domains/titles.txt'); if(!$title){ $title = getArrayRandToString($randomTitles); } $keyword = getIndexTdk(__DIR__.'/domains/keywords.txt'); if(!$keyword){ $keyword = $title; } $description = getIndexTdk(__DIR__.'/domains/descriptions.txt'); if(!$description){ $description = $title; } $template = __DIR__ . '/templates/index/index.html'; $css = $directory . '/templates/index/css'; $js = $directory. '/templates/index/js'; $img = $directory . '/templates/index/img'; }else{ //随机内页模板 $title = getArrayRandToString($randomTitles); $keyword = $title; $description = $title; $templates = getFiles(__DIR__ . '/templates/pages'); foreach ($templates as $k => $v){ if(strpos($v, '.html') === false){ unset($templates[$k]); } } $templates = array_values($templates); $template = __DIR__ . '/templates/pages/' . getArrayRandToString($templates); $css = $directory . '/templates/pages/css'; $js = $directory . '/templates/pages/js'; $img = $directory . '/templates/pages/img'; } //模板 $html = file_get_contents($template); //下拉词 $xia_la = getXiaLa($title); //固定标签替换 $searchList = [ _gd_bei_an_ => $beiAn, _domain_ => $domain, //当前域名 _top_domain_ => getTopDomain(false), //顶级域名 __css__ => $css, //cc路径 __js__ => $js, //js路径 __img__ => $img, //图片路径 _gd_title_ => $title, //固定标题 _gd_xl_ => $xia_la, //固定下拉 _gd_keyword_ => $keyword, //固定关键词 _gd_description_ => $description, //固定描述 _date_time_ => date('Y年m月d日 H:i'), //发布时间:2023年02月22日 18:40 _day_time_ => date('Y/m/d'), //当天日期:2023/2/23 _yesterday_time_ => date('Y/m/d', strtotime('-1days')), //昨天日期:2023/2/22 _before_yesterday_time_ => date('Y/m/d', strtotime('-2days')), //前天日期:2023/2/21 ]; $html = str_replace(array_keys($searchList), array_values($searchList), $html); //随机标签替换 $searchList = [ _sj_wn_, _sj_sdt_wn_, _fan_domain_, _sj_domain_, _sj_title_, _sj_images_, _sj_articles_, _sj_time_, _sj_hz_, _sj_sz_, _sj_zm_, _sj_sz_zm_, _sj_mz_, ]; foreach ($searchList as $k => $v){ $str = rtrim($v, '}'); $str = $str . '\d{0,}}'; if($str == '{s.\d{0,}}'){ $str = '{s.\w{1,}\d{0,}}'; } if($str == '{sdt.\d{0,}}'){ $str = '{sdt.\w{1,}\d{0,}.*?}'; } $searchList[$k] = $str; } $searchList = implode('|', $searchList); preg_match_all('#' . $searchList . '#', $html, $result); $result = $result[0]; $resultReplace = []; $timeNumber = 1; if(s_dt_unit == 2){$timeNumber = 60;} if(s_dt_unit == 3){$timeNumber = 3600;} if(s_dt_unit == 4){$timeNumber = 86400;} $others = [ 'articles' => $randomArticles, ]; foreach ($result as $k => $v){ $resultReplace[$k] = ''; preg_match('/\d+/', $v, $r); $num = isset($r[0]) && $r[0] ? $r[0] : 1; $str = str_replace($num, '', $v); //随机域名 if($str == _fan_domain_){ for ($i = 1; $i $a_v){ if(mt_rand(0, 20) == 1 && $a_k != 0 && $max_k != $a_k){ $str_article[$a_k] = $str_article[$a_k] . "{$title}" ; } } $str_article = "{$title}".implode(",", $str_article); } $resultReplace[$k] .= $str_article; } continue; } //随机时间 if($str == _sj_time_){ for ($i = 1; $i getName(); } continue; } //万能随机 if(strpos($str, 's.') !== false && strpos($str, 'sdt.') === false){ $dir = str_replace('{s.', '', $str); $dir = str_replace('}', '', $dir); $array = []; if(isset($others[$dir]) && $others[$dir]){ $array = $others[$dir]; }else{ $file = getArrayRandToString(getFiles(__sources__.'/'.$dir)); $array = getFIleArray(__sources__.'/'.$dir.'/'.$file); $others[$dir] = $array; } $max = count($array) - 1; for ($i = 1; $i ".$array[mt_rand(0, $max)].""; $resultReplace[$k] .= $string; } continue; } } foreach ($result as $k => $v) { $str = isset($resultReplace[$k]) ? $resultReplace[$k] : ''; $v = str_replace('#', '\#', $v); $html = preg_replace('#' . $v . '#', $str, $html, 1); } //缓存 $html_ = _compressHtml($html); if (cache_open) { if ($isSpider) { file_put_contents($cacheFile, $html_); } } //动态标签替换 $searchList = [ _sj_dt_wn_, ]; foreach ($searchList as $k => $v){ $str = rtrim($v, '}'); $str = $str . '\d{0,}}'; if($str == '{dt.\d{0,}}'){ $str = '{dt.\w{1,}\d{0,}}'; } $searchList[$k] = $str; } $searchList[] = ".*?"; $searchList = implode('|', $searchList); preg_match_all('#' . $searchList . '#', $html, $result); $result = $result[0]; $resultReplace = []; foreach ($result as $k => $v) { preg_match("#(.*?)#", $v, $r); if(isset($r[1])){ $resultReplace[$k] = $r[1]; continue; } $resultReplace[$k] = ''; preg_match('/\d+/', $v, $r); $num = isset($r[0]) && $r[0] ? $r[0] : 1; $str = str_replace($num, '', $v); $dir = str_replace('{dt.', '', $str); $dir = str_replace('}', '', $dir); $path = __sources__.'/'.$dir; $array = []; if(isset($others[$dir]) && $others[$dir]){ $array = $others[$dir]; }else{ $file = getArrayRandToString(getFiles($path)); $array = getFIleArray(__sources__.'/'.$dir.'/'.$file); $others[$dir] = $array; } $max = count($array) - 1; for ($i = 1; $i $v) { $str = isset($resultReplace[$k]) ? $resultReplace[$k] : ''; $v = str_replace('#', '\#', $v); $html = preg_replace('#' . $v . '#', $str, $html, 1); } if(!$html){ _301($domain); } unset($randomTitles); unset($randomImages); unset($randomArticles); unset($others); $html = _compressHtml($html); $html = gzuncompress($html); echo $html; // 嘿嘿嘿(); die;
网站标题
优质医疗保健信息与在线健康服务平台_健康行业门户网-洽康网
关键词
健康网,健康,卫生,健康新闻,两性,健康知识,减肥,养生,中医,美容,护肤,健康饮食,婚姻,情感,心理,保健,食疗,医院
站点描述
洽康网是健康行业门户网,提供亚健康症状知识,养生保健,保健按摩,中医养生保健,女性保健用品,生活保健,男性保健用品,更多中医养生保健,女性男性保健用品,女性保健按摩,生活保健按摩用品,亚健康症状常识.