Dedecms5.7百度主动推送PHP代码,如果,你还是不明白,那。。。。只能帮你到这里了…
这是干货,懂点代码的可以自己延伸(保存为任意PHP文件,放到plus目录下,访问看下结果?)。另外,避免手动提交的麻烦,可以服务器端设置个时间每天自动执行。
require_once(dirname(__file__).'/../include/common.inc.PHP'); require_once(DEDEINC."/channelunit.class.PHP"); $wheresql = ''; //设置推送时间 每天有指定配额 $year = date("Y"); $month = date("m"); $day = date("d"); $dayBegin = mktime(0,$month,0); line-height: 19.2px; background-color: inherit;">$day,0); line-height: 19.2px; background-color: inherit;">$year);//当天开始时间戳 $dayEnd = mktime(23,59,0); line-height: 19.2px; background-color: inherit;">//当天结束时间戳 $wheresql = "where arc.pubdate<".$dayEnd." AND arc.pubdate>".$dayBegin; $query = "SELECT arc.*,tp.* FROM `2ky_archives` arc left JOIN `2ky_arctype` tp ON arc.typeID=tp.ID $wheresql ORDER BY arc.ID DESC"; //下面网址换成自己的网站 $urls = ""; $dsql->Setquery($query); $dsql->Execute(); while($row = $dsql->GetArray()) { $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'], $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']).","; } $urls = substr($urls,-1); $urls = explode(",",0); line-height: 19.2px; background-color: inherit;">$urls); //API url换成自己的,站长工具里有 $API = 'http://data.zz.baIDu.com/urls?site=www.dede58.com&token=uUGps6ZBwuEYk0LW'; $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,0); line-height: 19.2px; background-color: inherit;">$options); $result = curl_exec($ch); echo $result; ?> 总结
以上是内存溢出为你收集整理的DedeCMS5.7百度主动推送(非实时)全部内容,希望文章能够帮你解决DedeCMS5.7百度主动推送(非实时)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)