花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來(lái)到素材無(wú)憂網(wǎng),按 + 收藏我們
登錄 注冊(cè) 退出 找回密碼

織夢(mèng)dedeCMS5.7非實(shí)時(shí)百度主動(dòng)推送

時(shí)間: 2018-04-26 21:44 閱讀: 作者:素材無(wú)憂網(wǎng)

DedeCMS5.7百度主動(dòng)推送PHP代碼,如果,你還是不明白,那。。。。只能幫你到這里了… 
這是干貨,懂點(diǎn)代碼的可以自己延伸(保存為任意php文件,放到plus目錄下,訪問(wèn)看下結(jié)果?)。另外,避免手動(dòng)提交的麻煩,可以服務(wù)器端設(shè)置個(gè)時(shí)間每天自動(dòng)執(zhí)行。 
織夢(mèng)dedeCMS5.7非實(shí)時(shí)百度主動(dòng)推送
<?php 
require_once(dirname(__FILE__).'/../include/common.inc.php'); 
require_once(DEDEINC."/channelunit.class.php"); 
$whereSql = ''; 
//設(shè)置推送時(shí)間 每天有指定配額 
$year = date("Y"); 
$month = date("m"); 
$day = date("d"); 
$dayBegin = mktime(0,0,0,$month,$day,$year);//當(dāng)天開(kāi)始時(shí)間戳 
$dayEnd = mktime(23,59,59,$month,$day,$year);//當(dāng)天結(jié)束時(shí)間戳 
$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";   
  
//下面網(wǎng)址換成自己的網(wǎng)站 
  
$urls = ""; 
$dsql->SetQuery($query); 
$dsql->Execute(); 
while($row = $dsql->GetArray()) 

$urls .= "http://www.dedecms51.com".GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], 
$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']).","; 

$urls = substr($urls,0,-1); 
$urls = explode(",",$urls); 
  
//api url換成自己的,站長(zhǎng)工具里有 
  
$api = 'http://data.zz.baidu.com/urls?site=www.dedecms51.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, $options); 
$result = curl_exec($ch); 
echo $result; 
?>

版權(quán)聲明: 本站資源均來(lái)自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請(qǐng)注明: 織夢(mèng)dedeCMS5.7非實(shí)時(shí)百度主動(dòng)推送

標(biāo)簽:  
相關(guān)文章
模板推薦