欢迎光临小鱼网个人网站!

登录/注册
织梦百度php主动推送代码

建立文件baidu.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,0,0,$month,$day,$year);//当天开始时间戳

$dayEnd = mktime(23,59,59,$month,$day,$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.""; 

$urls="";

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

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

{

 $urls.="域名".str_replace("{cmspath}","",$row['typedir'])."/".$row[id].".html".","; 

}

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

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

$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.count($urls);

?>


Copyright © www.xyubing.com All Rights Reserved. 备案号:蜀ICP备19023461号-1

免责声明:本站部分资源搜集整理于互联网或者网友提供,仅供学习与交流使用,如果不小心侵犯到你的权益,请及时联系我们删除该资源。