分类地区批量推送熊掌号+主动推送代码

   根据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("\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 => $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://www.sdfymj.com/invest/search-htm-areaid-1-catid-1118.html 的地址批量推送给百度

相关推荐