01<?php
02require_once("include/common.inc.php");
03require_once"include/arc.partview.class.php";
04require_once('include/charset.func.php');
05
06$year= date("Y");
07$month= date("m");
08$day= date("d");
09$dayBegin= mktime(0,0,0,$month,$day,$year);//当天开始时间戳
10$dayEnd= mktime(23,59,59,$month,$day,$year);//当天结束时间戳
11
12$query= "SELECT arch.id,types.typedir FROM dede_arctype as types inner join dede_archives as arch on types.id=arch.typeid where pubdate".$dayBegin.""; //这里dede换成你们自己的表前缀
13
14
15$urls="";
16
17$dsql->Execute('arch.id,types.typedir',$query);
18while($row= $dsql->GetArray('arch.id,types.typedir'))
19{
20$urls.="http://你的域名".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".",";
21//将上边的“http://你的域名”换成你的网址
22}
23$urls=substr($urls,0,-1);
24$urls= explode(",",$urls);
25
26$api= 'http://data.zz.baidu.com/urls?site=dedejs.com&token=xxxxx'; // 前边的site换成自己的site xxx换成自己的密钥
27$ch= curl_init();
28$options= array(
29CURLOPT_URL => $api,
30CURLOPT_POST => true,
31CURLOPT_RETURNTRANSFER => true,
32CURLOPT_POSTFIELDS => implode("\n", $urls),
33CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
34);
35curl_setopt_array($ch, $options);
36$result= curl_exec($ch);
37echo$result.count($urls);
38?>