隨著百度生態(tài)環(huán)境及算法改變,內(nèi)容質(zhì)量對于搜索引擎來說越來越重要了,那么信息的實(shí)時(shí)傳達(dá)到蜘蛛抓取是每位站長必須做到的事情了,鏈接提交工具是網(wǎng)站主動(dòng)向百度搜索推送數(shù)據(jù)的工具,工具可縮短爬蟲發(fā)現(xiàn)網(wǎng)站鏈接時(shí)間,網(wǎng)站時(shí)效性內(nèi)容建議使用鏈接提交工具,實(shí)時(shí)向搜索推送數(shù)據(jù)。本工具可加快爬蟲抓取速度,無法解決網(wǎng)站內(nèi)容是否收錄問題。
站長工具百度度推送分為“自動(dòng)提交”和“手動(dòng)提交”,手動(dòng)提交是最簡單直接的方式,然而也是最繁瑣的方法,所以最受用戶喜愛的推送方式當(dāng)然是自動(dòng)提交,而自動(dòng)提交又分為了“主動(dòng)推送(實(shí)時(shí))”、“自動(dòng)推送”和“sitemap”三種方式,后兩種相對比較簡單,而第一種相對設(shè)置要稍微復(fù)雜一點(diǎn),現(xiàn)在結(jié)合本人自己的情況說一說第一種。
及時(shí)發(fā)現(xiàn):可以縮短百度爬蟲發(fā)現(xiàn)您站點(diǎn)新鏈接的時(shí)間,使新發(fā)布的頁面可以在第一時(shí)間被百度收錄
保護(hù)原創(chuàng):對于網(wǎng)站的最新原創(chuàng)內(nèi)容,使用主動(dòng)推送功能可以快速通知到百度,使內(nèi)容可以在轉(zhuǎn)發(fā)之前被百度發(fā)現(xiàn)
建議先在命名建立文件為baiduxz_news.php 放在跟目錄下
<?phprequire_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)天開始時(shí)間戳$dayEnd = mktime(23,59,59,$month,$day,$year);//當(dāng)天結(jié)束時(shí)間戳$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.""; //這里dede換成你們自己的表前綴$urls="";$dsql->Execute('arch.id,types.typedir',$query);while($row = $dsql->GetArray('arch.id,types.typedir')){ $urls.="http://www.CUOxin.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".","; //將上邊的http://www.CUOxin.com 換成你的網(wǎng)址}$urls=substr($urls,0,-1);$urls = explode(",",$urls);$api = 'http://data.zz.baidu.com/urls?site=www.CUOxin.com&token=VtDwNoCne61ZfPRzh'; // 前邊的site換成自己的site xxx換成自己的密鑰$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.count($urls);?> |
如:http://www.CUOxin.com/baiduxz_news.php 如果返回代碼是:
{"remain":4999998, "success":2, "not_same_site":[],"not_valid":[]}

<?phprequire_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)行時(shí)間戳$dayEnd = mktime(23,59,59,$month,$day,$year);//當(dāng)天結(jié)束時(shí)間戳 $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.CUOxin.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";//將上邊的https://m.CUOxin.com換成你的網(wǎng)址}$urls=substr($urls,0,-1);$urls = explode(",",$urls);$api = 'http://data.zz.baidu.com/urls?appid=XXXXXXXXXX&token=xxxxxxxxxxxxx&type=batch';// 前邊的熊掌號(hào)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;?> |
詳情可以查看教程:DEDECMS織夢程序?qū)崿F(xiàn)熊掌號(hào)API提交接口推送(PHP推送)
新聞熱點(diǎn)
疑難解答
圖片精選