加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > Dedecms > 正文

DedeCMS5.7百度主动推送(非实时)

发布时间:2020-12-14 05:07:58 所属栏目:Dedecms 来源:网络整理
导读:DedeCMS5.7百度主动推送PHP代码,如果,你还是不明白,那。。。。只能帮你到这里了… 这是干货,懂点代码的可以自己延伸(保存为任意php文件,放到plus目录下,访问看下结果?)。另外,避免手动提交的麻烦,可以服务器端设置个时间每天自动执行。 ? require

DedeCMS5.7百度主动推送PHP代码,如果,你还是不明白,那。。。。只能帮你到这里了…

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

?


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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读