根目录建了一个 ping.php 文件中间放了以下代码; - <?php
- if(isset($_GET['action']))
- {
- $canshu=$_GET['action'];
- }
- function postUrl($url, $postvar)
- {
- $ch = curl_init();
- $headers = array(
- "POST ".$url." HTTP/1.0",
- "Content-type: text/xml; charset="utf-8"",
- "Accept: text/xml",
- "Content-length: ".strlen($postvar)
- );
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postvar);
- $res = curl_exec ($ch);
- curl_close ($ch);
- return $res;
- }
- $baiduXML = "<?xml version="1.0" encoding="utf-8"?>
- <methodCall>
- <methodName>weblogUpdates.extendedPing</methodName>
- <params>
- <param><value><string>维山在线,维山人论坛</string></value></param>
- <param><value><string>https://www.417626.com/</string></value></param>
- <param><value><string>https://www.417626.com/thread-$canshu-1-1.html</string></value></param>
- <param><value><string>https://www.417626.com/forum.php?mod=rss</string></value></param>
- </params>
- </methodCall>";
- $res = postUrl('http://ping.baidu.com/ping/RPC2', $baiduXML);
- if ( strpos($res, "<int>0</int>") )
- {
- header ("Location:https://www.417626.com/thread-$canshu-1-1.html");
- }
- else
- {
- header ("Location:https://www.417626.com/thread-$canshu-1-1.html#");
- }
- ?>
复制代码 修改文件source\include\post\post_newthread.php
找到: - showmessage('post_newthread_succeed', $returnurl, $values, $param);
复制代码替换为: - showmessage('post_newthread_succeed', "ping文件的文件名称.php?action=$tid", $values, $param);
复制代码附注:
Tips:
如果PING失败,那么你发新帖后跳转的网址最后面会有一个#号!
测试是否PING成功,也可以访问http://你的DZX网址/ping文件的文件名称.php?action=任意新帖子ID,不成功的话,网址后面会有#号。
记得顺手在这里提交一下你的BBS的RSS!
http://ping.baidu.com/ping.html
RSS地址是 http://你的DZX网址/forum.php?mod=rss
|