Destoon7.0百度批量循环推送至百度
因为新站上线,采集了很多数据,就做了一个百度批量循环推送至百度,来提高收录量,本插件免费,供广大朋友进行参考使用。
<?php /* 百度主动推送三项合一功能 作者:68喜科技 用于:DT7.0 功能模块:批量循环提交百度 */ //引入错误显示 error_reporting(E_ERROR | E_WARNING | E_PARSE); require '../common.inc.php'; //引入公用函数 $starid =1; //初始ID 开始 $limitList=2000; //限制条数 while($starid<550000){ $query = "SELECT itemid FROM {$DT_PRE}down_15 WHERE itemid> $starid ORDER BY itemid ASC LIMIT $limitList"; //查询数据库限制 //推送核心代码 $result = $db->query($query); $urls=""; $domain="http://www.domain.com/";//域名 while ($r=$db->fetch_array(($result))) { $linkId = $r['itemid']; //获取文章ID $linkurl ="baike/show-".$linkId.".html";//定义模块URL //修改域名 $urls.=$domain.$linkurl.","; //echo "为您推送的URL为:<br/>".$urls."<br/>"; } $urls=substr($urls,0,-1); $urls = explode(",",$urls); //接口推送 $api = 'mip推送接口';//mip推送 //$bdxzhapi='熊掌号接口';//熊掌号历史推送 $pttsapi='主动推送接口';//普通推送 $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 "百度MIP 推送成功:". $result."<br/>"; /* $options = array( CURLOPT_URL => $bdxzhapi, 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."<br/>"; */ $options = array( CURLOPT_URL => $pttsapi, 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."<br/>"; $starid=$starid+2000; //因为每一轮2000条推送 } ?>
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。