zoukankan      html  css  js  c++  java
  • 织梦主动推送当天全部内容给百度收录

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

      

    <?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("
    ", $urls),
            CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
    );
    curl_setopt_array($ch, $options);
    $result = curl_exec($ch);
    echo $result;
    ?>
    

      

  • 相关阅读:
    mysql基础以优化
    Mysql建立索引基础
    Mysql(1)
    SVN学习总结
    Github
    Java Eclipse断点调试
    Java设计模式图文详解
    代理模式
    Java——动态代理技术
    Spring基本概念理解
  • 原文地址:https://www.cnblogs.com/68xi/p/13346138.html
Copyright © 2011-2022 走看看