码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2020-02-19 00:36:08      阅读:19      评论:0      收藏:0      [点我收藏+]

标签:curl   lod   for   屏蔽   result   ret   ++   comm   head   

   根据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 的地址批量推送给百度

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

标签:curl   lod   for   屏蔽   result   ret   ++   comm   head   

原文地址:https://www.cnblogs.com/68xi/p/12329336.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!