How to automatically submit imperial cms to Baidu

angryTom
Release: 2019-07-31 14:34:50
Original
3628 people have browsed it

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); }
Copy after login

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

Add

> 
Copy after login

after

'>
Copy after login

in the last Add

  

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

Copy after login

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); } }
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!