搜狗站群sitemap:调用链轮库并生成随机二级主域名

由于曹操使用的是超度小说站群改造而成的搜狗站群,当使用过程中曹操又产生了另外一种方法:是否可以调用链轮库并生成随机二级主域名呢?于是便产生了下面的地图文件。

一目了然,下面的提交地图的方式是做泛二级域名用的。

伪静态

rewrite ^/(.*).xml$ /sitemap.php?id=$1;

sitemap.php

<?php
$arr = explode("/", $_SERVER['REQUEST_URI']);
$num = sizeof($arr);
header("Content-Type: text/xml");
$map = "\t<urlset>\r\n";
//$arrhost = explode(".",$_SERVER['HTTP_HOST']);

$date = date("Y-m-d");
//生成链接的条数以及规则
if($arrhost['2']!=''){
for ($i = 0; $i < 50; $i++) {
    $arrhost = explode(".",lianlun());
	$host = 'http://'.randchar(5,0).'.'.$arrhost['1'].'.'.$arrhost['2'].'/';
    $tmp = $host;
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$tmp}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
}}else{
	for ($i = 0; $i < 50; $i++) {
	$arrhost = explode(".",lianlun());
	$host = 'http://'.randchar(5,0).'.'.$arrhost['0'].'.'.$arrhost['1'].'/';
    $tmp = $host;
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$tmp}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
	
}}
$map.= "\t</urlset>";
echo $map;
die;

function lianlun()
    {
        $lianlun_file = file(str_replace('\\', '/', __DIR__) . '/ccseo/lianlun/url.txt');
        $lianlun = $lianlun_file[mt_rand(0,count($lianlun_file)-1)];
        return trim($lianlun);
    }
function randchar($length, $type)
    {
        $arr = array(1 => "abcdefghijklmnopqrstuvwxyz", 2 => "0123456789", 3 => "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        if($type == 0) {
            array_pop($arr);
            $string = implode("", $arr);
        }elseif($type == "-1") {
            $string = implode("", $arr);
        }else{
            $string = $arr[$type];
        }
        $count = strlen($string) - 1;
        for($i = 0; $i < $length; $i++)
        {
            $str[$i] = $string[rand(0, $count)];
            @$code .= $str[$i];
        }
        return $code;
    }
?>
本站所有内容仅限用于学习和研究目的,程序仅供本地断网测试,转载请说明出处!
站群SEO » 搜狗站群sitemap:调用链轮库并生成随机二级主域名

发表评论

欢迎 访客 发表评论

聚合全网站群程序及推送工具!

联系站长 联系客服