DT批量推送企业会员商铺地址到熊掌号+mip推送
因为seo需要,写了一个脚本,一键提交企业会员商铺地址到熊掌号+mip推送,希望对大家有用!
使用方法,在根目录新建一个tijiao.php文件
<?php /* 百度主动推送三项合一功能 作者:68喜科技 用于:DT7.0 功能模块:提交企业会员 */ //引入错误显示 error_reporting(E_ERROR | E_WARNING | E_PARSE); require 'common.inc.php'; //引入公用函数 $starid = $CFG['starid']; //初始ID,如果不调取公共函数,可以写死为1 $limitList=2000; //限制条数 $query = "SELECT linkurl FROM {$DT_PRE}company WHERE userid> $starid ORDER BY userid DESC LIMIT $limitList"; //查询数据库限制 $result = $db->query($query); $linkurls=""; while ($r=$db->fetch_array(($result))) { $url = $r['linkurl']; $linkurls.= $url.","; } echo "push item number is:".$linkurls."<br/>"; $urls = substr($linkurls,0,-1); $urls = explode(",",$linkurls); //接口推送 $api = '换上你的接口'; $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/>"; ?>
这样就能直接用浏览器运行即可
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。