Home>Article>CMS Tutorial> How to automatically submit imperial cms to Baidu

How to automatically submit imperial cms to Baidu

angryTom
angryTom Original
2019-07-31 14:34:50 3621browse

How to automatically submit imperial cms to Baidu

If you want to know more about Empire cms, you can click:Empire cms tutorial

Empire cms implements Baidu's active push (non-plugin) method.

Modify 3 files and find outecmsinfo.php,listinfo.php,userfun.php

1,e/admin/ecmsinfo.php

Add

elseif($enews=="Post_Baidu_sitemap")//文章实时发送百度 { $id=$_POST['id']; $urls=$_POST['titleurl']; ePostBaiduSitemap($id,$urls); }

2 after any elseif{....} ,e/data/html/list/listinfo.php

Add

> 

after

'>

in the last e6d621a2912e784107ba307ae077a6caAdd

  

备注:多选框蓝色为未审核信息;发布者红色为会员投稿;信息ID粗体为未生成,点击ID可刷新页面.

3 before the label,e/class/userfun.phpAdd

//发送给百度时时更新------------------------------- function ePostBaiduSitemap($id,$_urls){ $site = 'www.xxxxx.com';//你的网站域名 $token = 'xxxxxxx';//百度给的token $count = count($id); if (empty($count)) { printerror("未选择信息ID", "", 1, 0, 1); } $urls=array(); for($i=0;$i<$count;$i++) { $id[$i] = (int)$id[$i]; if (array_key_exists($id[$i],$_urls)){ $urls[] = $_urls[$id[$i]]; } } $api = "http://data.zz.baidu.com/urls?site=$site&token=$token"; $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); $httpstat = curl_getinfo($ch,CURLINFO_HTTP_CODE); curl_close($ch); if($httpstat==200){ $obj = json_decode($result); printerror("今天剩余{$obj->remain}条,成功提交{$obj->success}条", "", 1, 0, 1); }else{ printerror('推送失败', "", 1, 0, 1); } }

Use:

Website background - information

Click on any tree list on the left

## In the information management on the right, check the articles to be submitted to Baidu

Then click Batch Submit to Baidu below the list!

The above is the detailed content of How to automatically submit imperial cms to Baidu. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn