最新公告
  • 欢迎您光临仿站吧 帝国CMS模板一站式建站供应平台 . 欢迎加入VIP
  • 织梦CMS百度主动推送(非实时)

    正文概述 仿站吧   2022-04-23 22:59:21  

    (保存为任意php文件,放到plus目录下,访问看下结果?)。另外,避免手动提交的麻烦,可以服务器端设置个时间每天自动执行。

    织梦CMS百度主动推送(非实时) 第1张

    1.  <?php 
    2. require_once(dirname(__FILE__).'/../include/common.inc.php'); 
    3. require_once(DEDEINC."/channelunit.class.php"); 
    4. $whereSql = ''; 
    5. //设置推送时间 每天有指定配额 
    6. $year = date("Y"); 
    7. $month = date("m"); 
    8. $day = date("d"); 
    9. $dayBegin = mktime(0,0,0,$month,$day,$year);//当天开始时间戳 
    10. $dayEnd = mktime(23,59,59,$month,$day,$year);//当天结束时间戳 
    11. $whereSql = "where arc.pubdate<".$dayEnd." AND arc.pubdate>".$dayBegin; 
    12. $query = "SELECT arc.*,tp.* FROM `2ky_archives` arc 
    13. LEFT JOIN `2ky_arctype` tp ON arc.typeid=tp.id 
    14. $whereSql 
    15. ORDER BY arc.id DESC";  
    16.  
    17. //下面网址换成自己的网站 
    18.  
    19. $urls = ""; 
    20. $dsql->SetQuery($query); 
    21. $dsql->Execute(); 
    22. while($row = $dsql->GetArray()) 
    23. $urls .= "http://www.dede58.com".GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], 
    24. $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']).","; 
    25. $urls = substr($urls,0,-1); 
    26. $urls = explode(",",$urls);  
    27.  
    28. //api url换成自己的,站长工具里有 
    29.  
    30. $api = 'http://data.zz.baidu.com/urls?site=www.dede58.com&token=uUGps6ZBwuEYk0LW'; 
    31. $ch = curl_init(); 
    32. $options = array( 
    33. CURLOPT_URL => $api, 
    34. CURLOPT_POST => true, 
    35. CURLOPT_RETURNTRANSFER => true, 
    36. CURLOPT_POSTFIELDS => implode("\n", $urls), 
    37. CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), 
    38. ); 
    39. curl_setopt_array($ch, $options); 
    40. $result = curl_exec($ch); 
    41. echo $result; 
    42. ?> 
    仿站吧,一个优质的源码资源平台!
    仿站吧 » 织梦CMS百度主动推送(非实时)