国内外主机
测评及优惠码

百度主动推送插件 ( ver 1.1 ) for 杰奇1.7-2.4 based PHP

  • 百度主动推送插件 for 杰奇 1.7-2.4
  • 考虑到重复地址的惩罚问题,只做新章节推送
  • By 逆水行舟 2019-12-16 ( 2019-6-30 ver 1.0 )
  • 方法:将文件放于杰奇网站任意位置,访问即可。

直接上代码

<?php
/* 
  * 百度主动推送插件 for 杰奇 1.7-2.4
  * 方法:将文件放于杰奇网站任意位置,运行即可.
  * (考虑到重复地址的惩罚问题,只做新章节推送)
  * @逆水行舟  2019-12-16 ( 2019-6-30 ver 1.00 )
*/

//推送数量。百度规定一次不能超过2000
$num = 1000; 

//百度给你的接口地址。
$api = 'http://data.zz.baidu.com/urls?site=https://www.xxx.com&token=KwdknF1iQfLydL7A';

/* 章节页地址结构:
    {aid} -- 代表小说id  
    {cid} -- 代表章节id
    {subaid} -- 代表小说子序号(没有就不填)*/
$chapter_url = 'https://xxx.com/{subaid}_{aid}/{cid}.html'; //返回 https://xxx.com/51_51230/12345.html


/******** 以下代码请勿修改 ********/

date_default_timezone_set('Asia/Chongqing'); 
@set_time_limit(0);
@session_write_close();
header("Cache-Control: no-store, no-cache, must-revalidate");
require_once $_SERVER['DOCUMENT_ROOT'].'/configs/define.php';
if (floatval(phpversion()) >= 5.3){
  $con = mysqli_connect( JIEQI_DB_HOST, JIEQI_DB_USER, JIEQI_DB_PASS );
  mysqli_select_db( $con , JIEQI_DB_NAME );
  $query = mysqli_query ( $con, 'SELECT articleid,chapterid FROM jieqi_article_chapter ORDER BY lastupdate DESC LIMIT 0,'. $num );
}else{
  $con = mysql_connect(JIEQI_DB_HOST, JIEQI_DB_USER, JIEQI_DB_PASS);
  mysql_select_db( JIEQI_DB_NAME,$con );
  $query = mysql_query ( 'SELECT articleid,chapterid FROM jieqi_article_chapter ORDER BY lastupdate DESC LIMIT 0,'.$num, $con );
}
$postdata = '';
$is_subaid = strpos( $chapter_url, '{subaid}' ) !== false ? true : false;
while ( floatval(phpversion()) >= 5.3 ? $row =  mysqli_fetch_array($query): $row =  mysql_fetch_array($query)){
  if ( $is_subaid ) {
    $postdata .= str_replace( array('{aid}', '{cid}', '{subaid}'), array($row['articleid'], $row['chapterid'], intval($row['articleid'] / 1000)), $chapter_url ) . "\n";
  } else {
    $postdata .= str_replace( array('{aid}', '{cid}'), array( $row['articleid'], $row['chapterid']), $chapter_url ) . "\n";
  }
}
$curl = curl_init(); 
curl_setopt($curl, CURLOPT_URL, trim($api)); 
curl_setopt($curl, CURLOPT_POST, 1); 
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); 
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
$result = curl_exec($curl); 
curl_close($curl);
echo $result;

不想复制粘贴的,也为你准备好了文件:点击下载 bd_push.zip

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《百度主动推送插件 ( ver 1.1 ) for 杰奇1.7-2.4 based PHP》
文章链接:https://www.ibytx.com/243.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

评论 抢沙发

评论前必须登录!

 

'); })();