欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

代理加盟

2023全新代理計劃,一站式模板建站,銅牌代理低至699元送終身VIP,獨(dú)立代理后臺,自營貼牌。

您現(xiàn)在的位置: 麥站網(wǎng) > 織夢大學(xué) > 手機(jī)站教程 >

DEDECMS織夢程序?qū)崿F(xiàn)熊掌號API提交接口推送(PHP推送)

來源:本站原創(chuàng) 發(fā)布時間:2019-04-14 11:02:58熱度: ℃我要評論(0

麥站模板建站平臺(10年經(jīng)驗),服務(wù)數(shù)萬家企業(yè),固定透明報價。域名注冊、主機(jī)/服務(wù)器、網(wǎng)站源碼一站式服務(wù)。實體公司,專業(yè)團(tuán)隊,值得選擇!超過1000套模板已登記版權(quán),合規(guī)合法建站,規(guī)避版權(quán)風(fēng)險!【點(diǎn)擊獲取方案】

熊掌號的API提交分為新增內(nèi)容接口歷史內(nèi)容接口兩個接口。通過新增內(nèi)容接口,提交站內(nèi) 當(dāng)天新產(chǎn)生內(nèi)容的鏈接。新增內(nèi)容享受24小時內(nèi)抓取校驗、快速展現(xiàn)優(yōu)待。僅限提交綁定站點(diǎn)下的內(nèi)容,否則無法成功提交,配額不可累計,當(dāng)日有效。而通過歷史內(nèi)容接口,每天可提交最多500萬條有價值的內(nèi)容,所提交內(nèi)容會進(jìn)入百度搜索統(tǒng)一處理流程,這個過程需要一段時間。

一、PHP推送新增內(nèi)容接口代碼為:
 

$urls = array(
        'http://mengdiqiu.com.cn/1.html',
        'http://mengdiqiu.com.cn/2.html',
);
$api = 'http://data.zz.baidu.com/urls?appid=XXXXXXXXX&token=xxxxxxxxxxxxx&type=realtime';
$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 $result;

DedeCMS熊掌號API提交之新增內(nèi)容接口代碼:

<?php
require_once ("include/common.inc.php");
require_once "include/arc.partview.class.php";
require_once('include/charset.func.php');
 
$year = date("Y");
$month = date("m");
$day = date("d");
$dayBegin = mktime(0,0,0,$month,$day,$year);//當(dāng)天開始時間戳
$dayEnd = mktime(23,59,59,$month,$day,$year);//當(dāng)天結(jié)束時間戳 
 
$query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin."";
//echo $query;
 
$urls="";
 
$dsql->Execute('arch.id,types.typedir',$query);
while($row = $dsql->GetArray('arch.id,types.typedir'))
{
$urls.="https://m.xiuzhanwang.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";
//將上邊m.xiuzhanwang.com換成你的網(wǎng)址
}
$urls=substr($urls,0,-1);
$urls = explode(",",$urls);
 
$api = 'http://data.zz.baidu.com/urls?appid=熊掌號ID&token=密鑰&type=realtime'; // 前邊的熊掌號ID和密鑰換成自己的
$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 $result;
?>
 

二、PHP推送歷史內(nèi)容接口代碼為

$urls = array(
        'http://mengdiqiu.com.cn/1.html',
        'http://mengdiqiu.com.cn/2.html',
);
$api = 'http://data.zz.baidu.com/urls?appid=XXXXXXXXXX&token=xxxxxxxxxxxxx&type=batch';
$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 $result;


DedeCMS熊掌號API提交之歷史內(nèi)容接口代碼:

<?php
require_once ("include/common.inc.php");
require_once "include/arc.partview.class.php";
require_once('include/charset.func.php');
 
$year = date("Y");
$month = date("m");
$day = date("d");
$dayBegin = mktime(0,0,0,7,1,2015);//網(wǎng)站開始運(yùn)行時間戳
$dayEnd = mktime(23,59,59,$month,$day,$year);//當(dāng)天結(jié)束時間戳 
 
$query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin."";
//echo $query;
 
$urls="";
 
$dsql->Execute('arch.id,types.typedir',$query);
while($row = $dsql->GetArray('arch.id,types.typedir'))
{
$urls.="https://m.xiuzhanwang.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";
//將上邊的https://m.xiuzhanwang.com換成你的網(wǎng)址
}
$urls=substr($urls,0,-1);
$urls = explode(",",$urls);
 
$api = 'http://data.zz.baidu.com/urls?appid=XXXXXXXXXX&token=xxxxxxxxxxxxx&type=batch';// 前邊的熊掌號ID和密鑰換成自己
$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 $result;
?>

代碼釋義:

1、$query中“dede_archives”為自己數(shù)據(jù)庫中存放文章的表,如果你的數(shù)據(jù)庫表頭做了修改,這里也要做相應(yīng)修改。

2、本代碼自動獲取當(dāng)天發(fā)布的所有文章鏈接,設(shè)置兩個時間戳,0:0:0和23:59:59,也就是把當(dāng)天這兩個時間內(nèi)的文章都自動提取出來,即是當(dāng)天新增內(nèi)容內(nèi)容。

3、$api=http://data.zz.baidu.com/urls?appid=熊掌號ID&token=密鑰&type=realtime,請登錄您的賬號查看接口調(diào)用地址。


下載文件DedeCMS熊掌號API提交新增內(nèi)容接口文件和DedeCMS熊掌號API提交歷史內(nèi)容接口文件,解壓后,修改文件,將文件中的密鑰和網(wǎng)址改成自己的即可,將修改后的PHP文件上傳到網(wǎng)站根目錄,瀏覽器中輸入:你的域名/baiduxz_new.php和你的域名/baiduxz_old.php,即可看到API提交的效果。

網(wǎng)盤下載:https://pan.baidu.com/s/1unqgztIpc9CoU7D2voNa5w 提取碼: mjuz 

    轉(zhuǎn)載請注明來源網(wǎng)址:http://mengdiqiu.com.cn/dedecms_m/982.html

    發(fā)表評論

    評論列表(條)

       
      QQ在線咨詢
      VIP限時特惠