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 out ecmsinfo.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
<input name="id[]" type="checkbox" id="id[]" value="<?=$r[id]?>"<?=$checked?>> <input name="infoid[]" type="hidden" value="<?=$r['id']?>">
after
<input name="titleurl[<?=$r[id]?>]" type="hidden" value='<?=$titleurl?>'>
in the last table>Add
<tr bgcolor="#FFFFFF"> <td height="25" colspan="8"> <input type="submit" name="Submit101" value="批量提交百度" onClick="document.listform.enews.value='Post_Baidu_sitemap';document.listform.action='ecmsinfo.php';"><font color="#666666"><p>备注:多选框蓝色为未审核信息;发布者红色为会员投稿;信息ID粗体为未生成,点击ID可刷新页面.</p></font></td> </tr>
3 before the label, e/class/userfun.php
Add
//发送给百度时时更新------------------------------- 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!