织梦dedecms程序熊掌号自动提交方法

今天给大家分享dedecms织梦怎么做熊掌号自动提交方法,织梦使用的是另外的一个二级目录,所以在提交熊掌号的时候有点复杂!

第一步:在\plus\task目录下新建一个php文件,命名为xzh.php代码如下:

require_once(dirname(FILE).’/…/…/include/common.inc.php’);

require_once(DEDEINC."/arc.partview.class.php");

require_once(dirname(FILE).’/…/…/include/charset.func.php’);

$year = date(“Y”);

$month = date(“m”);

$day = date(“d”);

d a y B e g i n = m k t i m e ( 0 , 0 , 0 , dayBegin = mktime(0,0,0, dayBegin=mktime(0,0,0,month, d a y , day, day,year);

d a y E n d = m k t i m e ( 23 , 59 , 59 , dayEnd = mktime(23,59,59, dayEnd=mktime(23,59,59,month, d a y , day, day,year);

q u e r y = " S E L E C T a r c h . i d , t y p e s . t y p e d i r F R O M d e d e a r c t y p e a s t y p e s i n n e r j o i n d e d e a r c h i v e s a s a r c h o n t y p e s . i d = a r c h . t y p e i d w h e r e p u b d a t e < " . query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<". query="SELECTarch.id,types.typedirFROMdedearctypeastypesinnerjoindedearchivesasarchontypes.id=arch.typeidwherepubdate<".dayEnd." AND pubdate>".$dayBegin."";

//echo $query;

$urls="";

d s q l − > E x e c u t e ( ′ a r c h . i d , t y p e s . t y p e d i r ′ , dsql->Execute('arch.id,types.typedir', dsql>Execute(arch.id,types.typedir,query);

while($row = $dsql->GetArray(‘arch.id,types.typedir’))

{

$urls.="$urls.="https://www.maimuban.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";".",";        

}

u r l s = s u b s t r ( urls=substr( urls=substr(urls,0,-1);

$tjurl = $urls;

u r l s = e x p l o d e ( " , " , urls = explode(",", urls=explode(",",urls);

$api = ‘http://data.zz.baidu.com/urls?appid=1567968668883362&token=TqR2soisGxVnnKiN&type=realtime’; // 熊掌号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);

r e s u l t = c u r l e x e c ( result = curl_exec( result=curlexec(ch);

echo $result;

$dsql->ExecuteNoneQuery("Update xiuzhanwang_sys_task set sta=‘成功’ where dourl=‘xzh.php’ ");

j i e g u o = d a t e ( ′ Y − m − d H : i : s ′ , t i m e ( ) ) . " 返 回 结 果 : " . jieguo = date('Y-m-d H:i:s',time())."返回结果:". jieguo=date(YmdH:i:s,time())."".result."\r\n".$tjurl;

$numbytes = file_put_contents(‘xzh.txt’, $jieguo); //返回结果

exit();

第二步:在网站后台系统-计划任务管理里面新增一个任务,运行程序填xzh.php,设定好执行规则。

第三步:在模板中用JS调用/plus/task.php?client=js任务执行成功之后会在\plus\task目录下生成一个xzh.txt文件,返回提交结果、任务执行时间、提交的url,如下图:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值