复制代码1、e/admin/ecmsinfo.php 文件中,在任意一个elseif{....} 后添加添加如下代码
elseif($enews=="Post_Baidu_sitemap")
{ //文章实时发送百度
$id=$_POST['id'];
$urls=$_POST['titleurl'];
ePostBaiduSitemap($id,$urls);
}
2、找到 e/data/html/list/listinfo.php 文件,找到如下代码:
<input name="id[]" type="checkbox" id="id[]" value="<?=$r[id]?>"<?=$checked?>>
<input name="infoid[]" type="hidden" value="<?=$r['id']?>">
在其后面添加下面的代码:
<input name="titleurl[<?=$r[id]?>]" type="hidden" value='<?=$titleurl?>'>
然后在最后一个</table>标签前添加如下代码:
<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、找到e/class/userfun.php添加如下代码:
//发送给百度时时更新-------------------------------
function ePostBaiduSitemap($id,$_urls){
$site = 'www.ipkd.cn';//你的网站域名
$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);
}
}
//轻轻松松完成!
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
上面是“帝国cms发布文章后直接提交百度(主动推送代码”的全面内容,想了解更多关于 帝国cms 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_1416.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!