标签:substr 标签 http 作者 历史 引入 功能 report 参考
因为自己最近做搜索聚合页面,有大量的搜索标签,于是自己开发了一个多功能推送插件,包括:MIP推送+熊掌号推送+历史普通推送。发布在这里,如果有需要的朋友,可以拿去参考改进!
`<?php
/
百度主动推送三项合一功能
作者:68喜科技
用于:DT6.0
功能模块:tags标签推送熊掌号+MIP+普通主动推送
/
//引入错误显示
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require ‘../common.inc.php‘; //引入公用函数
$starid =1; //初始ID 开
$limitList=2000; //限制条数
//资讯标签推送
$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=21 ORDER BY itemid ASC LIMIT $limitList"; //查询数据库限制
//产品展示推送
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=5 ORDER BY itemid ASC LIMIT $limitList"; //查询数据库限制
//图库展示推送
//$query = "SELECT letter FROM {$DT_PRE}keyword WHERE itemid> $starid AND MODULEID=12 ORDER BY itemid ASC LIMIT $limitList"; //查询数据库限制
//推送核心代码
$result = $db->query($query);
$urls="";
$domain="http://zhimo.yuanzhumuban.cc/";//域名
while ($r=$db->fetch_array(($result)))
{
$linkId = $r[‘letter‘]; //获取文章ID
$linkurl ="news/search-htm-kw-".$linkId.".html";//定义模块URL
//修改域名
$urls.=$domain.$linkurl.",";
echo "为您推送的URL为:<br/>".$urls."<br/>";
}
$urls=substr($urls,0,-1);
$urls = explode(",",$urls);
//接口推送
$api = ‘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/>";
?>`
另外做了聚合索引页面,http://zhimo.yuanzhumuban.cc/hotkey/
DT内核圆柱模板行业站点主动tags三项主动推送插件
标签:substr 标签 http 作者 历史 引入 功能 report 参考
原文地址:http://blog.51cto.com/11024720/2317752