分类地区批量推送熊掌号+主动推送代码
Posted 68xi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了分类地区批量推送熊掌号+主动推送代码相关的知识,希望对你有一定的参考价值。
根据dt7.0写了一个非常简单的分类地区批量推送百度熊掌号+普通主动推送
<?php /* 百度主动推送三项合一功能 作者:68喜 功能模块:地区推送 */ //错误显示屏蔽 require ‘./common.inc.php‘; //引入公用函数 $domain=$CFG[‘url‘]; $module="invest/";//目录模块 $catid=1118;//分类id $qian="search-htm-kw-"; $zhong="-catid-"; $hou=".html"; for($areaid=1;$areaid<392;$areaid++){ $urls.=$domain.$module.$qian.$areaid.$zhong.$catid.$hou.","; } $urls=substr($urls,0,-1); $urls = explode(",",$urls); //接口推送 $api = ‘api‘;//熊掌号当天推送 $bdxzhapi=‘api‘;//熊掌号历史推送 $pttsapi=‘api‘;//普通推送 $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."<br/>"; $options = array( CURLOPT_URL => $bdxzhapi, 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."<br/>"; $options = array( CURLOPT_URL => $pttsapi, 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."<br/>"; ?>
例如这样的:http://www.sdfymj.com/invest/search-htm-areaid-1-catid-1118.html 的地址批量推送给百度
以上是关于分类地区批量推送熊掌号+主动推送代码的主要内容,如果未能解决你的问题,请参考以下文章
Zzzj Submit:WordPress 百度熊掌号/原创保护文章数据推送插件 V3.4