zoukankan      html  css  js  c++  java
  • DT产品模块批量循环提交百度

       功能需求:DT7.0产品模块批量循环提交百度,让没有收录的内容重新进行抓取,以提高收录。

        

      代码如下:

        

    <?php
    /*
    百度主动推送三项合一功能
    作者:68喜科技
    用于:DT7.0 
    功能模块:批量循环提交百度
    */
    //引入错误显示
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
    require './common.inc.php'; //引入公用函数
    $starid =1;   //初始ID 开始
    $limitList=1000; //限制条数
    while($starid<120000){
    $query = "SELECT itemid FROM {$DT_PRE}sell_5 WHERE  itemid> $starid ORDER BY itemid ASC  LIMIT $limitList";   //查询数据库限制
    //推送核心代码
    $result = $db->query($query);
    $urls="";
    $domain="http://www.sdfymj.com/";//域名
    while ($r=$db->fetch_array(($result)))
    {  
     $linkId = $r['itemid'];  //获取文章ID
     $linkurl ="sell/show-".$linkId.".html";//定义模块URL
    //修改域名
    $urls.=$domain.$linkurl.",";
    //echo "为您推送的URL为:<br/>".$urls."<br/>";
    }
    $urls=substr($urls,0,-1);
    $urls = explode(",",$urls);
    //接口推送
    //$api = 'mip推送接口';//mip推送
    //$bdxzhapi='熊掌号接口';//熊掌号历史推送
    $pttsapi='普通推送接口';//普通推送
    $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  "百度MIP 推送成功:". $result."<br/>";
     */
     /*
    $options =  array(
         CURLOPT_URL => $bdxzhapi,
        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."<br/>";
    */
    $options =  array(
         CURLOPT_URL => $pttsapi,
        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."<br/>";
     
     $starid=$starid+2000; //因为每一轮2000条推送
    }
     ?>
    

      

       

  • 相关阅读:
    bzoj3507: [Cqoi2014]通配符匹配
    bzoj2120: 数颜色
    bzoj2038: [2009国家集训队]小Z的袜子(hose)
    laravel表单图片上传
    laravel使用$errors提取错误信息
    laravel中的old()函数
    laravel的函数asset()、url()
    laravel表单提交
    laravel中if
    laravel的foreach
  • 原文地址:https://www.cnblogs.com/68xi/p/12851488.html
Copyright © 2011-2022 走看看