织梦主动推送当天全部内容给百度收录

  织梦主动推送当天全部内容给百度收录,附上代码:

  

<?php
require_once ("include/common.inc.php");
require_once "include/arc.partview.class.php";
require_once('include/charset.func.php');
$year = date("Y");
$month = date("m");
$day = date("d");
$dayBegin = mktime(0,0,0,7,1,2015);//网站开始运行时间戳
$dayEnd = mktime(23,59,59,$month,$day,$year);//当天结束时间戳 
$query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin."";
//echo $query;
$urls="";
               
$dsql->Execute('arch.id,types.typedir',$query);
while($row = $dsql->GetArray('arch.id,types.typedir'))
{
    $urls.="换成你的域名".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";   
    //将上边的url换成你的网址
}
$urls=substr($urls,0,-1);
$urls    = explode(",",$urls);
$api = 'api接口';// 换成你自己的主动推送接口
$ch = curl_init();
$options = array(
        CURLOPT_URL => $api,
        CURLOPT_POST => true,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POSTFIELDS => implode("\n", $urls),
        CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
echo $result;
?>

  

posted @ 2020-07-20 17:11  圆柱模板  阅读(282)  评论(1编辑  收藏  举报