君语贤
时光静好,与君语;细水流年,与君同;繁华落尽,与君老...

织梦开发>功能优化>正文

dede织梦熊掌号新增内容接口提交改造

2019-01-24 12:17 君语贤

执行提交链接结果:

dede织梦熊掌号新增内容接口提交改造

具体操作:在网站根目录或者指定目录创建一个PHP文件,例如 :xiong.php,然后插入以下代码:

<?php

require_once ("include/common.inc.php");

require_once "include/arc.partview.class.php";

require_once('include/charset.func.php');

$year = date("Y");

$month = date("m");

$day = date("d");

$dayBegin = mktime(0,$month,$day,$year);//当天开始时间戳

$dayEnd = mktime(23,59,$year);//当天结束时间戳

$query = "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate<".$dayEnd." AND pubdate>".$dayBegin."";

//echo $query;

$urls="";

$dsql->Execute('arch.id,types.typedir',$query);

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

{

$urls.="http://blog.weguiding.com".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";

}

$urls=substr($urls,-1);

$urls = explode(",",$urls);

$api = 'http://data.zz.baidu.com/urls?appid=XXX&token=XXXXX'; //这里填写对应的提交接口

$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;

?>

配置好以后直接访问文件所在的链接即可提交成功。需要注意的一点是,该条链接多次访问会额外暂用提交配额,建议一次性提交。

本文链接:https://www.weguiding.com/gnyh/343.html

图文推荐
热门标签
dede织梦自定义表单文章调用页面修改模板tag代码