KURUN CLOUD洛杉矶服务器,CN2GIA+CUPM9929+CMIN2,顶级回国线路,机房直销
直接上代码
<?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。